diff --git a/eng/mgmt/automation/api-specs.yaml b/eng/mgmt/automation/api-specs.yaml index ae3a99f7effaf..fe9c48e5346cb 100644 --- a/eng/mgmt/automation/api-specs.yaml +++ b/eng/mgmt/automation/api-specs.yaml @@ -60,6 +60,8 @@ hybridaks: service: hybridcontainerservice keyvault: suffix: generated +liftrastronomer: + service: astro liftrqumulo: service: qumulo loadtestservice: diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 8907bdc8f2145..8e071c6c1b553 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -443,6 +443,7 @@ com.azure.resourcemanager:azure-resourcemanager-playwrighttesting;1.0.0-beta.1;1 com.azure.resourcemanager:azure-resourcemanager-recoveryservicesdatareplication;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-networkanalytics;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-springappdiscovery;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-astro;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 diff --git a/pom.xml b/pom.xml index e9f22cfd462bf..e4cbd41a79af5 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ sdk/appconfiguration sdk/appcontainers sdk/applicationinsights + sdk/astro sdk/attestation sdk/automanage sdk/automation diff --git a/sdk/astro/azure-resourcemanager-astro/CHANGELOG.md b/sdk/astro/azure-resourcemanager-astro/CHANGELOG.md new file mode 100644 index 0000000000000..555a46b2a94fa --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/CHANGELOG.md @@ -0,0 +1,6 @@ +# Release History + +## 1.0.0-beta.1 (2024-02-22) + +- Azure Resource Manager Astro client library for Java. This package contains Microsoft Azure SDK for Astro Management SDK. Package tag package-2023-08-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + diff --git a/sdk/astro/azure-resourcemanager-astro/README.md b/sdk/astro/azure-resourcemanager-astro/README.md new file mode 100644 index 0000000000000..920b46241980e --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/README.md @@ -0,0 +1,107 @@ +# Azure Resource Manager Astro client library for Java + +Azure Resource Manager Astro client library for Java. + +This package contains Microsoft Azure SDK for Astro Management SDK. Package tag package-2023-08-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-astro;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-astro + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +AstroManager manager = AstroManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/astro/azure-resourcemanager-astro/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fastro%2Fazure-resourcemanager-astro%2FREADME.png) diff --git a/sdk/astro/azure-resourcemanager-astro/SAMPLE.md b/sdk/astro/azure-resourcemanager-astro/SAMPLE.md new file mode 100644 index 0000000000000..dc85a3cab6566 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/SAMPLE.md @@ -0,0 +1,257 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## Organizations + +- [CreateOrUpdate](#organizations_createorupdate) +- [Delete](#organizations_delete) +- [GetByResourceGroup](#organizations_getbyresourcegroup) +- [List](#organizations_list) +- [ListByResourceGroup](#organizations_listbyresourcegroup) +- [Update](#organizations_update) +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void operationsListGeneratedByMaximumSetRule(com.azure.resourcemanager.astro.AstroManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_CreateOrUpdate + +```java +import com.azure.resourcemanager.astro.models.LiftrBaseDataOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseMarketplaceDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseOfferDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetails; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Organizations CreateOrUpdate. + */ +public final class OrganizationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_CreateOrUpdate - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void + organizationsCreateOrUpdateGeneratedByMaximumSetRule(com.azure.resourcemanager.astro.AstroManager manager) { + manager.organizations().define("U.1-:7").withRegion("mhqthlsatwvqkl").withExistingResourceGroup("rgastronomer") + .withTags(mapOf()) + .withProperties(new LiftrBaseDataOrganizationProperties() + .withMarketplace(new LiftrBaseMarketplaceDetails().withSubscriptionId("ntthclydlpqmasr") + .withSubscriptionStatus(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START) + .withOfferDetails(new LiftrBaseOfferDetails().withPublisherId("gfsqxygpnerxmvols") + .withOfferId("krzkefmpxztqyusidzgpchfaswuyce").withPlanId("kndxzygsanuiqzwbfbbvoipv") + .withPlanName("pwqjwlq").withTermUnit("xyygyzcazkuelz").withTermId("pwds"))) + .withUser(new LiftrBaseUserDetails().withFirstName("nfh").withLastName("lazfbstcccykibvcrxpmglqam") + .withEmailAddress(".K_@e7N-g1.xjqnbPs").withUpn("xtutvycpxjrtoftx").withPhoneNumber("inxkscllh")) + .withPartnerOrganizationProperties( + new LiftrBaseDataPartnerOrganizationProperties().withOrganizationId("lskgzdmziusgrsucv") + .withWorkspaceId("vcrupxwpaba").withOrganizationName("3-").withWorkspaceName("9.:06") + .withSingleSignOnProperties(new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL).withEnterpriseAppId("mklfypyujwumgwdzae") + .withSingleSignOnUrl("ymmtzkyghvinvhgnqlzwrr").withAadDomains(Arrays.asList("kfbleh"))))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Organizations_Delete + +```java +/** + * Samples for Organizations Delete. + */ +public final class OrganizationsDeleteSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Delete - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void + organizationsDeleteGeneratedByMaximumSetRule(com.azure.resourcemanager.astro.AstroManager manager) { + manager.organizations().delete("rgastronomer", "q:", com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_GetByResourceGroup + +```java +/** + * Samples for Organizations GetByResourceGroup. + */ +public final class OrganizationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Get - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void organizationsGetGeneratedByMaximumSetRule(com.azure.resourcemanager.astro.AstroManager manager) { + manager.organizations().getByResourceGroupWithResponse("rgastronomer", "S PS", + com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_List + +```java +/** + * Samples for Organizations List. + */ +public final class OrganizationsListSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_ListBySubscription - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void + organizationsListBySubscriptionGeneratedByMaximumSetRule(com.azure.resourcemanager.astro.AstroManager manager) { + manager.organizations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_ListByResourceGroup + +```java +/** + * Samples for Organizations ListByResourceGroup. + */ +public final class OrganizationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_ListByResourceGroup - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void organizationsListByResourceGroupGeneratedByMaximumSetRule( + com.azure.resourcemanager.astro.AstroManager manager) { + manager.organizations().listByResourceGroup("rgastronomer", com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_Update + +```java +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationPropertiesUpdate; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetailsUpdate; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.OrganizationResource; +import com.azure.resourcemanager.astro.models.OrganizationResourceUpdateProperties; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Organizations Update. + */ +public final class OrganizationsUpdateSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Update. + * + * @param manager Entry point to AstroManager. + */ + public static void organizationsUpdate(com.azure.resourcemanager.astro.AstroManager manager) { + OrganizationResource resource = manager.organizations() + .getByResourceGroupWithResponse("rgastronomer", "6.", com.azure.core.util.Context.NONE).getValue(); + resource.update().withTags(mapOf("key1474", "fakeTokenPlaceholder")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .withProperties(new OrganizationResourceUpdateProperties() + .withUser(new LiftrBaseUserDetailsUpdate().withFirstName("qeuofehzypzljgcuysugefbgxde") + .withLastName("g").withEmailAddress(".K_@e7N-g1.xjqnbPs").withUpn("uwtprzdfpsqmktx") + .withPhoneNumber("aqpyxznvqpgkzohevynofrjdfgoo")) + .withPartnerOrganizationProperties(new LiftrBaseDataPartnerOrganizationPropertiesUpdate() + .withOrganizationId("lrtmbkvyvvoszhjevohkmyjhfyty").withWorkspaceId("xsepuskdhejaadusyxq") + .withOrganizationName("U2P_").withWorkspaceName("L.-y_--:") + .withSingleSignOnProperties(new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL).withEnterpriseAppId("mklfypyujwumgwdzae") + .withSingleSignOnUrl("ymmtzkyghvinvhgnqlzwrr").withAadDomains(Arrays.asList("kfbleh"))))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/astro/azure-resourcemanager-astro/pom.xml b/sdk/astro/azure-resourcemanager-astro/pom.xml new file mode 100644 index 0000000000000..c140e9092ac53 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/pom.xml @@ -0,0 +1,110 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-astro + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Astro Management + This package contains Microsoft Azure SDK for Astro Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2023-08-01. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.46.0 + + + com.azure + azure-core-management + 1.11.10 + + + com.azure + azure-core-test + 1.23.0 + test + + + com.azure + azure-identity + 1.11.2 + test + + + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + + + org.mockito + mockito-core + 4.11.0 + test + + + net.bytebuddy + byte-buddy + 1.14.8 + test + + + net.bytebuddy + byte-buddy-agent + 1.14.8 + test + + + org.slf4j + slf4j-simple + 1.7.36 + test + + + diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/AstroManager.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/AstroManager.java new file mode 100644 index 0000000000000..6b07523f7fb0c --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/AstroManager.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.astro.fluent.AstroMgmtClient; +import com.azure.resourcemanager.astro.implementation.AstroMgmtClientBuilder; +import com.azure.resourcemanager.astro.implementation.OperationsImpl; +import com.azure.resourcemanager.astro.implementation.OrganizationsImpl; +import com.azure.resourcemanager.astro.models.Operations; +import com.azure.resourcemanager.astro.models.Organizations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to AstroManager. + */ +public final class AstroManager { + private Operations operations; + + private Organizations organizations; + + private final AstroMgmtClient clientObject; + + private AstroManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new AstroMgmtClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()).subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval).buildClient(); + } + + /** + * Creates an instance of Astro service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Astro service API instance. + */ + public static AstroManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Astro service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Astro service API instance. + */ + public static AstroManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new AstroManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create AstroManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AstroManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Astro service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Astro service API instance. + */ + public AstroManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java").append("-").append("com.azure.resourcemanager.astro").append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (").append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ").append(Configuration.getGlobalConfiguration().get("os.name")).append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")).append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY).collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])).build(); + return new AstroManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Organizations. It manages OrganizationResource. + * + * @return Resource collection API of Organizations. + */ + public Organizations organizations() { + if (this.organizations == null) { + this.organizations = new OrganizationsImpl(clientObject.getOrganizations(), this); + } + return organizations; + } + + /** + * Gets wrapped service client AstroMgmtClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client AstroMgmtClient. + */ + public AstroMgmtClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/AstroMgmtClient.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/AstroMgmtClient.java new file mode 100644 index 0000000000000..30b51b17e3d2e --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/AstroMgmtClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for AstroMgmtClient class. + */ +public interface AstroMgmtClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the OrganizationsClient object to access its operations. + * + * @return the OrganizationsClient object. + */ + OrganizationsClient getOrganizations(); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/OperationsClient.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/OperationsClient.java new file mode 100644 index 0000000000000..ab8fd8dbfa8e2 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.astro.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/OrganizationsClient.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/OrganizationsClient.java new file mode 100644 index 0000000000000..2b8c30fa30fcf --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/OrganizationsClient.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.astro.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.astro.models.OrganizationResourceUpdate; + +/** + * An instance of this class provides access to all the operations defined in OrganizationsClient. + */ +public interface OrganizationsClient { + /** + * List OrganizationResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List OrganizationResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String organizationName, Context context); + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrganizationResourceInner getByResourceGroup(String resourceGroupName, String organizationName); + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OrganizationResourceInner> + beginCreateOrUpdate(String resourceGroupName, String organizationName, OrganizationResourceInner resource); + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OrganizationResourceInner> beginCreateOrUpdate( + String resourceGroupName, String organizationName, OrganizationResourceInner resource, Context context); + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrganizationResourceInner createOrUpdate(String resourceGroupName, String organizationName, + OrganizationResourceInner resource); + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrganizationResourceInner createOrUpdate(String resourceGroupName, String organizationName, + OrganizationResourceInner resource, Context context); + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OrganizationResourceInner> beginUpdate(String resourceGroupName, + String organizationName, OrganizationResourceUpdate properties); + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OrganizationResourceInner> beginUpdate(String resourceGroupName, + String organizationName, OrganizationResourceUpdate properties, Context context); + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrganizationResourceInner update(String resourceGroupName, String organizationName, + OrganizationResourceUpdate properties); + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrganizationResourceInner update(String resourceGroupName, String organizationName, + OrganizationResourceUpdate properties, Context context); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String organizationName); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String organizationName, Context context); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String organizationName); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String organizationName, Context context); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/models/OperationInner.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..256e3aaae0959 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/models/OperationInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.astro.models.ActionType; +import com.azure.resourcemanager.astro.models.OperationDisplay; +import com.azure.resourcemanager.astro.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/models/OrganizationResourceInner.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/models/OrganizationResourceInner.java new file mode 100644 index 0000000000000..aa8c5a6444ea9 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/models/OrganizationResourceInner.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.astro.models.LiftrBaseDataOrganizationProperties; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * Organization Resource by Astronomer. + */ +@Fluent +public final class OrganizationResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private LiftrBaseDataOrganizationProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of OrganizationResourceInner class. + */ + public OrganizationResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public LiftrBaseDataOrganizationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the OrganizationResourceInner object itself. + */ + public OrganizationResourceInner withProperties(LiftrBaseDataOrganizationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the OrganizationResourceInner object itself. + */ + public OrganizationResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * {@inheritDoc} + */ + @Override + public OrganizationResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public OrganizationResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/models/package-info.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/models/package-info.java new file mode 100644 index 0000000000000..fddf4966272a3 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for AstroMgmtClient. + * null. + */ +package com.azure.resourcemanager.astro.fluent.models; diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/package-info.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/package-info.java new file mode 100644 index 0000000000000..7c12b8a6360db --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for AstroMgmtClient. + * null. + */ +package com.azure.resourcemanager.astro.fluent; diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/AstroMgmtClientBuilder.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/AstroMgmtClientBuilder.java new file mode 100644 index 0000000000000..13b3f231b0d4f --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/AstroMgmtClientBuilder.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the AstroMgmtClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { AstroMgmtClientImpl.class }) +public final class AstroMgmtClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the AstroMgmtClientBuilder. + */ + public AstroMgmtClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AstroMgmtClientBuilder. + */ + public AstroMgmtClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the AstroMgmtClientBuilder. + */ + public AstroMgmtClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the AstroMgmtClientBuilder. + */ + public AstroMgmtClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the AstroMgmtClientBuilder. + */ + public AstroMgmtClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the AstroMgmtClientBuilder. + */ + public AstroMgmtClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AstroMgmtClientImpl with the provided parameters. + * + * @return an instance of AstroMgmtClientImpl. + */ + public AstroMgmtClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + AstroMgmtClientImpl client = new AstroMgmtClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/AstroMgmtClientImpl.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/AstroMgmtClientImpl.java new file mode 100644 index 0000000000000..d55376bdfd423 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/AstroMgmtClientImpl.java @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.astro.fluent.AstroMgmtClient; +import com.azure.resourcemanager.astro.fluent.OperationsClient; +import com.azure.resourcemanager.astro.fluent.OrganizationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the AstroMgmtClientImpl type. + */ +@ServiceClient(builder = AstroMgmtClientBuilder.class) +public final class AstroMgmtClientImpl implements AstroMgmtClient { + /** + * The ID of the target subscription. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The OrganizationsClient object to access its operations. + */ + private final OrganizationsClient organizations; + + /** + * Gets the OrganizationsClient object to access its operations. + * + * @return the OrganizationsClient object. + */ + public OrganizationsClient getOrganizations() { + return this.organizations; + } + + /** + * Initializes an instance of AstroMgmtClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + AstroMgmtClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2023-08-01"; + this.operations = new OperationsClientImpl(this); + this.organizations = new OrganizationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter().deserialize(errorBody, ManagementError.class, + SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AstroMgmtClientImpl.class); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OperationImpl.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OperationImpl.java new file mode 100644 index 0000000000000..83bb2d3138925 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.implementation; + +import com.azure.resourcemanager.astro.fluent.models.OperationInner; +import com.azure.resourcemanager.astro.models.ActionType; +import com.azure.resourcemanager.astro.models.Operation; +import com.azure.resourcemanager.astro.models.OperationDisplay; +import com.azure.resourcemanager.astro.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.astro.AstroManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.astro.AstroManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.astro.AstroManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OperationsClientImpl.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..bdfcdd10656e5 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OperationsClientImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.astro.fluent.OperationsClient; +import com.azure.resourcemanager.astro.fluent.models.OperationInner; +import com.azure.resourcemanager.astro.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final AstroMgmtClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AstroMgmtClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AstroMgmtClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AstroMgmtClientOpera") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Astronomer.Astro/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OperationsImpl.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..b52f15bb023ff --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OperationsImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.astro.fluent.OperationsClient; +import com.azure.resourcemanager.astro.fluent.models.OperationInner; +import com.azure.resourcemanager.astro.models.Operation; +import com.azure.resourcemanager.astro.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.astro.AstroManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.astro.AstroManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.astro.AstroManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OrganizationResourceImpl.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OrganizationResourceImpl.java new file mode 100644 index 0000000000000..a092cd6ffef3c --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OrganizationResourceImpl.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.astro.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.astro.models.LiftrBaseDataOrganizationProperties; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.azure.resourcemanager.astro.models.OrganizationResource; +import com.azure.resourcemanager.astro.models.OrganizationResourceUpdate; +import com.azure.resourcemanager.astro.models.OrganizationResourceUpdateProperties; +import java.util.Collections; +import java.util.Map; + +public final class OrganizationResourceImpl + implements OrganizationResource, OrganizationResource.Definition, OrganizationResource.Update { + private OrganizationResourceInner innerObject; + + private final com.azure.resourcemanager.astro.AstroManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public LiftrBaseDataOrganizationProperties properties() { + return this.innerModel().properties(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public OrganizationResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.astro.AstroManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String organizationName; + + private OrganizationResourceUpdate updateProperties; + + public OrganizationResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public OrganizationResource create() { + this.innerObject = serviceManager.serviceClient().getOrganizations().createOrUpdate(resourceGroupName, + organizationName, this.innerModel(), Context.NONE); + return this; + } + + public OrganizationResource create(Context context) { + this.innerObject = serviceManager.serviceClient().getOrganizations().createOrUpdate(resourceGroupName, + organizationName, this.innerModel(), context); + return this; + } + + OrganizationResourceImpl(String name, com.azure.resourcemanager.astro.AstroManager serviceManager) { + this.innerObject = new OrganizationResourceInner(); + this.serviceManager = serviceManager; + this.organizationName = name; + } + + public OrganizationResourceImpl update() { + this.updateProperties = new OrganizationResourceUpdate(); + return this; + } + + public OrganizationResource apply() { + this.innerObject = serviceManager.serviceClient().getOrganizations().update(resourceGroupName, organizationName, + updateProperties, Context.NONE); + return this; + } + + public OrganizationResource apply(Context context) { + this.innerObject = serviceManager.serviceClient().getOrganizations().update(resourceGroupName, organizationName, + updateProperties, context); + return this; + } + + OrganizationResourceImpl(OrganizationResourceInner innerObject, + com.azure.resourcemanager.astro.AstroManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.organizationName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "organizations"); + } + + public OrganizationResource refresh() { + this.innerObject = serviceManager.serviceClient().getOrganizations() + .getByResourceGroupWithResponse(resourceGroupName, organizationName, Context.NONE).getValue(); + return this; + } + + public OrganizationResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getOrganizations() + .getByResourceGroupWithResponse(resourceGroupName, organizationName, context).getValue(); + return this; + } + + public OrganizationResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public OrganizationResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public OrganizationResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public OrganizationResourceImpl withProperties(LiftrBaseDataOrganizationProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public OrganizationResourceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + public OrganizationResourceImpl withProperties(OrganizationResourceUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OrganizationsClientImpl.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OrganizationsClientImpl.java new file mode 100644 index 0000000000000..9b7e18f7b941c --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OrganizationsClientImpl.java @@ -0,0 +1,1300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.astro.fluent.OrganizationsClient; +import com.azure.resourcemanager.astro.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.astro.models.OrganizationResourceListResult; +import com.azure.resourcemanager.astro.models.OrganizationResourceUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OrganizationsClient. + */ +public final class OrganizationsClientImpl implements OrganizationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OrganizationsService service; + + /** + * The service client containing this operation class. + */ + private final AstroMgmtClientImpl client; + + /** + * Initializes an instance of OrganizationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OrganizationsClientImpl(AstroMgmtClientImpl client) { + this.service + = RestProxy.create(OrganizationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AstroMgmtClientOrganizations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AstroMgmtClientOrgan") + public interface OrganizationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Astronomer.Astro/organizations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("organizationName") String organizationName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("organizationName") String organizationName, + @BodyParam("application/json") OrganizationResourceInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("organizationName") String organizationName, + @BodyParam("application/json") OrganizationResourceUpdate properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("organizationName") String organizationName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List OrganizationResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List OrganizationResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List OrganizationResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List OrganizationResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List OrganizationResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List OrganizationResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String organizationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String organizationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationName, accept, context); + } + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String organizationName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, organizationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String organizationName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, organizationName, context).block(); + } + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrganizationResourceInner getByResourceGroup(String resourceGroupName, String organizationName) { + return getByResourceGroupWithResponse(resourceGroupName, organizationName, Context.NONE).getValue(); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String organizationName, OrganizationResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String organizationName, OrganizationResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationName, resource, accept, context); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OrganizationResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String organizationName, OrganizationResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, organizationName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), OrganizationResourceInner.class, OrganizationResourceInner.class, + this.client.getContext()); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OrganizationResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String organizationName, OrganizationResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, organizationName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), OrganizationResourceInner.class, OrganizationResourceInner.class, context); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OrganizationResourceInner> + beginCreateOrUpdate(String resourceGroupName, String organizationName, OrganizationResourceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, organizationName, resource).getSyncPoller(); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OrganizationResourceInner> beginCreateOrUpdate( + String resourceGroupName, String organizationName, OrganizationResourceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, organizationName, resource, context).getSyncPoller(); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String organizationName, + OrganizationResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, organizationName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String organizationName, + OrganizationResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, organizationName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrganizationResourceInner createOrUpdate(String resourceGroupName, String organizationName, + OrganizationResourceInner resource) { + return createOrUpdateAsync(resourceGroupName, organizationName, resource).block(); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrganizationResourceInner createOrUpdate(String resourceGroupName, String organizationName, + OrganizationResourceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, organizationName, resource, context).block(); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String organizationName, + OrganizationResourceUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String organizationName, + OrganizationResourceUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, organizationName, properties, accept, context); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OrganizationResourceInner> + beginUpdateAsync(String resourceGroupName, String organizationName, OrganizationResourceUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, organizationName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), OrganizationResourceInner.class, OrganizationResourceInner.class, + this.client.getContext()); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OrganizationResourceInner> beginUpdateAsync( + String resourceGroupName, String organizationName, OrganizationResourceUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, organizationName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), OrganizationResourceInner.class, OrganizationResourceInner.class, context); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OrganizationResourceInner> + beginUpdate(String resourceGroupName, String organizationName, OrganizationResourceUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, organizationName, properties).getSyncPoller(); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OrganizationResourceInner> beginUpdate( + String resourceGroupName, String organizationName, OrganizationResourceUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, organizationName, properties, context).getSyncPoller(); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String organizationName, + OrganizationResourceUpdate properties) { + return beginUpdateAsync(resourceGroupName, organizationName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String organizationName, + OrganizationResourceUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, organizationName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrganizationResourceInner update(String resourceGroupName, String organizationName, + OrganizationResourceUpdate properties) { + return updateAsync(resourceGroupName, organizationName, properties).block(); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return organization Resource by Astronomer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrganizationResourceInner update(String resourceGroupName, String organizationName, + OrganizationResourceUpdate properties, Context context) { + return updateAsync(resourceGroupName, organizationName, properties, context).block(); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String organizationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String organizationName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, organizationName, accept, context); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String organizationName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, organizationName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String organizationName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, organizationName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String organizationName) { + return this.beginDeleteAsync(resourceGroupName, organizationName).getSyncPoller(); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String organizationName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, organizationName, context).getSyncPoller(); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String organizationName) { + return beginDeleteAsync(resourceGroupName, organizationName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String organizationName, Context context) { + return beginDeleteAsync(resourceGroupName, organizationName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String organizationName) { + deleteAsync(resourceGroupName, organizationName).block(); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String organizationName, Context context) { + deleteAsync(resourceGroupName, organizationName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OrganizationsImpl.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OrganizationsImpl.java new file mode 100644 index 0000000000000..75734768781de --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/OrganizationsImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.astro.fluent.OrganizationsClient; +import com.azure.resourcemanager.astro.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.astro.models.OrganizationResource; +import com.azure.resourcemanager.astro.models.Organizations; + +public final class OrganizationsImpl implements Organizations { + private static final ClientLogger LOGGER = new ClientLogger(OrganizationsImpl.class); + + private final OrganizationsClient innerClient; + + private final com.azure.resourcemanager.astro.AstroManager serviceManager; + + public OrganizationsImpl(OrganizationsClient innerClient, + com.azure.resourcemanager.astro.AstroManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String organizationName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, organizationName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OrganizationResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OrganizationResource getByResourceGroup(String resourceGroupName, String organizationName) { + OrganizationResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, organizationName); + if (inner != null) { + return new OrganizationResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String organizationName) { + this.serviceClient().delete(resourceGroupName, organizationName); + } + + public void delete(String resourceGroupName, String organizationName, Context context) { + this.serviceClient().delete(resourceGroupName, organizationName, context); + } + + public OrganizationResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String organizationName = ResourceManagerUtils.getValueFromIdByName(id, "organizations"); + if (organizationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'organizations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, organizationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String organizationName = ResourceManagerUtils.getValueFromIdByName(id, "organizations"); + if (organizationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'organizations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, organizationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String organizationName = ResourceManagerUtils.getValueFromIdByName(id, "organizations"); + if (organizationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'organizations'.", id))); + } + this.delete(resourceGroupName, organizationName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String organizationName = ResourceManagerUtils.getValueFromIdByName(id, "organizations"); + if (organizationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'organizations'.", id))); + } + this.delete(resourceGroupName, organizationName, context); + } + + private OrganizationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.astro.AstroManager manager() { + return this.serviceManager; + } + + public OrganizationResourceImpl define(String name) { + return new OrganizationResourceImpl(name, this.manager()); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/ResourceManagerUtils.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..fda0396249d8d --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/ResourceManagerUtils.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/package-info.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/package-info.java new file mode 100644 index 0000000000000..55e3b0b66858c --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for AstroMgmtClient. + * null. + */ +package com.azure.resourcemanager.astro.implementation; diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ActionType.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ActionType.java new file mode 100644 index 0000000000000..5907499ec9f62 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ActionType.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseDataOrganizationProperties.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseDataOrganizationProperties.java new file mode 100644 index 0000000000000..cb4d1c44dbe86 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseDataOrganizationProperties.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties specific to Data Organization resource. + */ +@Fluent +public final class LiftrBaseDataOrganizationProperties { + /* + * Marketplace details of the resource. + */ + @JsonProperty(value = "marketplace", required = true) + private LiftrBaseMarketplaceDetails marketplace; + + /* + * Details of the user. + */ + @JsonProperty(value = "user", required = true) + private LiftrBaseUserDetails user; + + /* + * Provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ResourceProvisioningState provisioningState; + + /* + * Organization properties + */ + @JsonProperty(value = "partnerOrganizationProperties") + private LiftrBaseDataPartnerOrganizationProperties partnerOrganizationProperties; + + /** + * Creates an instance of LiftrBaseDataOrganizationProperties class. + */ + public LiftrBaseDataOrganizationProperties() { + } + + /** + * Get the marketplace property: Marketplace details of the resource. + * + * @return the marketplace value. + */ + public LiftrBaseMarketplaceDetails marketplace() { + return this.marketplace; + } + + /** + * Set the marketplace property: Marketplace details of the resource. + * + * @param marketplace the marketplace value to set. + * @return the LiftrBaseDataOrganizationProperties object itself. + */ + public LiftrBaseDataOrganizationProperties withMarketplace(LiftrBaseMarketplaceDetails marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get the user property: Details of the user. + * + * @return the user value. + */ + public LiftrBaseUserDetails user() { + return this.user; + } + + /** + * Set the user property: Details of the user. + * + * @param user the user value to set. + * @return the LiftrBaseDataOrganizationProperties object itself. + */ + public LiftrBaseDataOrganizationProperties withUser(LiftrBaseUserDetails user) { + this.user = user; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the partnerOrganizationProperties property: Organization properties. + * + * @return the partnerOrganizationProperties value. + */ + public LiftrBaseDataPartnerOrganizationProperties partnerOrganizationProperties() { + return this.partnerOrganizationProperties; + } + + /** + * Set the partnerOrganizationProperties property: Organization properties. + * + * @param partnerOrganizationProperties the partnerOrganizationProperties value to set. + * @return the LiftrBaseDataOrganizationProperties object itself. + */ + public LiftrBaseDataOrganizationProperties + withPartnerOrganizationProperties(LiftrBaseDataPartnerOrganizationProperties partnerOrganizationProperties) { + this.partnerOrganizationProperties = partnerOrganizationProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (marketplace() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property marketplace in model LiftrBaseDataOrganizationProperties")); + } else { + marketplace().validate(); + } + if (user() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property user in model LiftrBaseDataOrganizationProperties")); + } else { + user().validate(); + } + if (partnerOrganizationProperties() != null) { + partnerOrganizationProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LiftrBaseDataOrganizationProperties.class); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseDataPartnerOrganizationProperties.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseDataPartnerOrganizationProperties.java new file mode 100644 index 0000000000000..049edc5dca94c --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseDataPartnerOrganizationProperties.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties specific to Partner's organization. + */ +@Fluent +public final class LiftrBaseDataPartnerOrganizationProperties { + /* + * Organization Id in partner's system + */ + @JsonProperty(value = "organizationId") + private String organizationId; + + /* + * Workspace Id in partner's system + */ + @JsonProperty(value = "workspaceId") + private String workspaceId; + + /* + * Organization name in partner's system + */ + @JsonProperty(value = "organizationName", required = true) + private String organizationName; + + /* + * Workspace name in partner's system + */ + @JsonProperty(value = "workspaceName") + private String workspaceName; + + /* + * Single Sign On properties for the organization + */ + @JsonProperty(value = "singleSignOnProperties") + private LiftrBaseSingleSignOnProperties singleSignOnProperties; + + /** + * Creates an instance of LiftrBaseDataPartnerOrganizationProperties class. + */ + public LiftrBaseDataPartnerOrganizationProperties() { + } + + /** + * Get the organizationId property: Organization Id in partner's system. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: Organization Id in partner's system. + * + * @param organizationId the organizationId value to set. + * @return the LiftrBaseDataPartnerOrganizationProperties object itself. + */ + public LiftrBaseDataPartnerOrganizationProperties withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the workspaceId property: Workspace Id in partner's system. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: Workspace Id in partner's system. + * + * @param workspaceId the workspaceId value to set. + * @return the LiftrBaseDataPartnerOrganizationProperties object itself. + */ + public LiftrBaseDataPartnerOrganizationProperties withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the organizationName property: Organization name in partner's system. + * + * @return the organizationName value. + */ + public String organizationName() { + return this.organizationName; + } + + /** + * Set the organizationName property: Organization name in partner's system. + * + * @param organizationName the organizationName value to set. + * @return the LiftrBaseDataPartnerOrganizationProperties object itself. + */ + public LiftrBaseDataPartnerOrganizationProperties withOrganizationName(String organizationName) { + this.organizationName = organizationName; + return this; + } + + /** + * Get the workspaceName property: Workspace name in partner's system. + * + * @return the workspaceName value. + */ + public String workspaceName() { + return this.workspaceName; + } + + /** + * Set the workspaceName property: Workspace name in partner's system. + * + * @param workspaceName the workspaceName value to set. + * @return the LiftrBaseDataPartnerOrganizationProperties object itself. + */ + public LiftrBaseDataPartnerOrganizationProperties withWorkspaceName(String workspaceName) { + this.workspaceName = workspaceName; + return this; + } + + /** + * Get the singleSignOnProperties property: Single Sign On properties for the organization. + * + * @return the singleSignOnProperties value. + */ + public LiftrBaseSingleSignOnProperties singleSignOnProperties() { + return this.singleSignOnProperties; + } + + /** + * Set the singleSignOnProperties property: Single Sign On properties for the organization. + * + * @param singleSignOnProperties the singleSignOnProperties value to set. + * @return the LiftrBaseDataPartnerOrganizationProperties object itself. + */ + public LiftrBaseDataPartnerOrganizationProperties + withSingleSignOnProperties(LiftrBaseSingleSignOnProperties singleSignOnProperties) { + this.singleSignOnProperties = singleSignOnProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (organizationName() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property organizationName in model LiftrBaseDataPartnerOrganizationProperties")); + } + if (singleSignOnProperties() != null) { + singleSignOnProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LiftrBaseDataPartnerOrganizationProperties.class); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseDataPartnerOrganizationPropertiesUpdate.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseDataPartnerOrganizationPropertiesUpdate.java new file mode 100644 index 0000000000000..7c6ec33588a20 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseDataPartnerOrganizationPropertiesUpdate.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties specific to Partner's organization. + */ +@Fluent +public final class LiftrBaseDataPartnerOrganizationPropertiesUpdate { + /* + * Organization Id in partner's system + */ + @JsonProperty(value = "organizationId") + private String organizationId; + + /* + * Workspace Id in partner's system + */ + @JsonProperty(value = "workspaceId") + private String workspaceId; + + /* + * Organization name in partner's system + */ + @JsonProperty(value = "organizationName") + private String organizationName; + + /* + * Workspace name in partner's system + */ + @JsonProperty(value = "workspaceName") + private String workspaceName; + + /* + * Single Sign On properties for the organization + */ + @JsonProperty(value = "singleSignOnProperties") + private LiftrBaseSingleSignOnProperties singleSignOnProperties; + + /** + * Creates an instance of LiftrBaseDataPartnerOrganizationPropertiesUpdate class. + */ + public LiftrBaseDataPartnerOrganizationPropertiesUpdate() { + } + + /** + * Get the organizationId property: Organization Id in partner's system. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: Organization Id in partner's system. + * + * @param organizationId the organizationId value to set. + * @return the LiftrBaseDataPartnerOrganizationPropertiesUpdate object itself. + */ + public LiftrBaseDataPartnerOrganizationPropertiesUpdate withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the workspaceId property: Workspace Id in partner's system. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: Workspace Id in partner's system. + * + * @param workspaceId the workspaceId value to set. + * @return the LiftrBaseDataPartnerOrganizationPropertiesUpdate object itself. + */ + public LiftrBaseDataPartnerOrganizationPropertiesUpdate withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the organizationName property: Organization name in partner's system. + * + * @return the organizationName value. + */ + public String organizationName() { + return this.organizationName; + } + + /** + * Set the organizationName property: Organization name in partner's system. + * + * @param organizationName the organizationName value to set. + * @return the LiftrBaseDataPartnerOrganizationPropertiesUpdate object itself. + */ + public LiftrBaseDataPartnerOrganizationPropertiesUpdate withOrganizationName(String organizationName) { + this.organizationName = organizationName; + return this; + } + + /** + * Get the workspaceName property: Workspace name in partner's system. + * + * @return the workspaceName value. + */ + public String workspaceName() { + return this.workspaceName; + } + + /** + * Set the workspaceName property: Workspace name in partner's system. + * + * @param workspaceName the workspaceName value to set. + * @return the LiftrBaseDataPartnerOrganizationPropertiesUpdate object itself. + */ + public LiftrBaseDataPartnerOrganizationPropertiesUpdate withWorkspaceName(String workspaceName) { + this.workspaceName = workspaceName; + return this; + } + + /** + * Get the singleSignOnProperties property: Single Sign On properties for the organization. + * + * @return the singleSignOnProperties value. + */ + public LiftrBaseSingleSignOnProperties singleSignOnProperties() { + return this.singleSignOnProperties; + } + + /** + * Set the singleSignOnProperties property: Single Sign On properties for the organization. + * + * @param singleSignOnProperties the singleSignOnProperties value to set. + * @return the LiftrBaseDataPartnerOrganizationPropertiesUpdate object itself. + */ + public LiftrBaseDataPartnerOrganizationPropertiesUpdate + withSingleSignOnProperties(LiftrBaseSingleSignOnProperties singleSignOnProperties) { + this.singleSignOnProperties = singleSignOnProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (singleSignOnProperties() != null) { + singleSignOnProperties().validate(); + } + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseMarketplaceDetails.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseMarketplaceDetails.java new file mode 100644 index 0000000000000..ae917fc55e125 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseMarketplaceDetails.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Marketplace details for an organization. + */ +@Fluent +public final class LiftrBaseMarketplaceDetails { + /* + * Azure subscription id for the the marketplace offer is purchased from + */ + @JsonProperty(value = "subscriptionId", required = true) + private String subscriptionId; + + /* + * Marketplace subscription status + */ + @JsonProperty(value = "subscriptionStatus") + private MarketplaceSubscriptionStatus subscriptionStatus; + + /* + * Offer details for the marketplace that is selected by the user + */ + @JsonProperty(value = "offerDetails", required = true) + private LiftrBaseOfferDetails offerDetails; + + /** + * Creates an instance of LiftrBaseMarketplaceDetails class. + */ + public LiftrBaseMarketplaceDetails() { + } + + /** + * Get the subscriptionId property: Azure subscription id for the the marketplace offer is purchased from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Azure subscription id for the the marketplace offer is purchased from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the LiftrBaseMarketplaceDetails object itself. + */ + public LiftrBaseMarketplaceDetails withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the subscriptionStatus property: Marketplace subscription status. + * + * @return the subscriptionStatus value. + */ + public MarketplaceSubscriptionStatus subscriptionStatus() { + return this.subscriptionStatus; + } + + /** + * Set the subscriptionStatus property: Marketplace subscription status. + * + * @param subscriptionStatus the subscriptionStatus value to set. + * @return the LiftrBaseMarketplaceDetails object itself. + */ + public LiftrBaseMarketplaceDetails withSubscriptionStatus(MarketplaceSubscriptionStatus subscriptionStatus) { + this.subscriptionStatus = subscriptionStatus; + return this; + } + + /** + * Get the offerDetails property: Offer details for the marketplace that is selected by the user. + * + * @return the offerDetails value. + */ + public LiftrBaseOfferDetails offerDetails() { + return this.offerDetails; + } + + /** + * Set the offerDetails property: Offer details for the marketplace that is selected by the user. + * + * @param offerDetails the offerDetails value to set. + * @return the LiftrBaseMarketplaceDetails object itself. + */ + public LiftrBaseMarketplaceDetails withOfferDetails(LiftrBaseOfferDetails offerDetails) { + this.offerDetails = offerDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subscriptionId() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property subscriptionId in model LiftrBaseMarketplaceDetails")); + } + if (offerDetails() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property offerDetails in model LiftrBaseMarketplaceDetails")); + } else { + offerDetails().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LiftrBaseMarketplaceDetails.class); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseOfferDetails.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseOfferDetails.java new file mode 100644 index 0000000000000..ff76541ddd914 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseOfferDetails.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Offer details for the marketplace that is selected by the user. + */ +@Fluent +public final class LiftrBaseOfferDetails { + /* + * Publisher Id for the marketplace offer + */ + @JsonProperty(value = "publisherId", required = true) + private String publisherId; + + /* + * Offer Id for the marketplace offer + */ + @JsonProperty(value = "offerId", required = true) + private String offerId; + + /* + * Plan Id for the marketplace offer + */ + @JsonProperty(value = "planId", required = true) + private String planId; + + /* + * Plan Name for the marketplace offer + */ + @JsonProperty(value = "planName") + private String planName; + + /* + * Plan Display Name for the marketplace offer + */ + @JsonProperty(value = "termUnit") + private String termUnit; + + /* + * Plan Display Name for the marketplace offer + */ + @JsonProperty(value = "termId") + private String termId; + + /** + * Creates an instance of LiftrBaseOfferDetails class. + */ + public LiftrBaseOfferDetails() { + } + + /** + * Get the publisherId property: Publisher Id for the marketplace offer. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Set the publisherId property: Publisher Id for the marketplace offer. + * + * @param publisherId the publisherId value to set. + * @return the LiftrBaseOfferDetails object itself. + */ + public LiftrBaseOfferDetails withPublisherId(String publisherId) { + this.publisherId = publisherId; + return this; + } + + /** + * Get the offerId property: Offer Id for the marketplace offer. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Set the offerId property: Offer Id for the marketplace offer. + * + * @param offerId the offerId value to set. + * @return the LiftrBaseOfferDetails object itself. + */ + public LiftrBaseOfferDetails withOfferId(String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Get the planId property: Plan Id for the marketplace offer. + * + * @return the planId value. + */ + public String planId() { + return this.planId; + } + + /** + * Set the planId property: Plan Id for the marketplace offer. + * + * @param planId the planId value to set. + * @return the LiftrBaseOfferDetails object itself. + */ + public LiftrBaseOfferDetails withPlanId(String planId) { + this.planId = planId; + return this; + } + + /** + * Get the planName property: Plan Name for the marketplace offer. + * + * @return the planName value. + */ + public String planName() { + return this.planName; + } + + /** + * Set the planName property: Plan Name for the marketplace offer. + * + * @param planName the planName value to set. + * @return the LiftrBaseOfferDetails object itself. + */ + public LiftrBaseOfferDetails withPlanName(String planName) { + this.planName = planName; + return this; + } + + /** + * Get the termUnit property: Plan Display Name for the marketplace offer. + * + * @return the termUnit value. + */ + public String termUnit() { + return this.termUnit; + } + + /** + * Set the termUnit property: Plan Display Name for the marketplace offer. + * + * @param termUnit the termUnit value to set. + * @return the LiftrBaseOfferDetails object itself. + */ + public LiftrBaseOfferDetails withTermUnit(String termUnit) { + this.termUnit = termUnit; + return this; + } + + /** + * Get the termId property: Plan Display Name for the marketplace offer. + * + * @return the termId value. + */ + public String termId() { + return this.termId; + } + + /** + * Set the termId property: Plan Display Name for the marketplace offer. + * + * @param termId the termId value to set. + * @return the LiftrBaseOfferDetails object itself. + */ + public LiftrBaseOfferDetails withTermId(String termId) { + this.termId = termId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publisherId() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property publisherId in model LiftrBaseOfferDetails")); + } + if (offerId() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property offerId in model LiftrBaseOfferDetails")); + } + if (planId() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property planId in model LiftrBaseOfferDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LiftrBaseOfferDetails.class); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseSingleSignOnProperties.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseSingleSignOnProperties.java new file mode 100644 index 0000000000000..e3510b2a9d8bc --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseSingleSignOnProperties.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Properties specific to Single Sign On Resource. + */ +@Fluent +public final class LiftrBaseSingleSignOnProperties { + /* + * State of the Single Sign On for the organization + */ + @JsonProperty(value = "singleSignOnState") + private SingleSignOnStates singleSignOnState; + + /* + * AAD enterprise application Id used to setup SSO + */ + @JsonProperty(value = "enterpriseAppId") + private String enterpriseAppId; + + /* + * URL for SSO to be used by the partner to redirect the user to their system + */ + @JsonProperty(value = "singleSignOnUrl") + private String singleSignOnUrl; + + /* + * List of AAD domains fetched from Microsoft Graph for user. + */ + @JsonProperty(value = "aadDomains") + private List aadDomains; + + /* + * Provisioning State of the resource + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of LiftrBaseSingleSignOnProperties class. + */ + public LiftrBaseSingleSignOnProperties() { + } + + /** + * Get the singleSignOnState property: State of the Single Sign On for the organization. + * + * @return the singleSignOnState value. + */ + public SingleSignOnStates singleSignOnState() { + return this.singleSignOnState; + } + + /** + * Set the singleSignOnState property: State of the Single Sign On for the organization. + * + * @param singleSignOnState the singleSignOnState value to set. + * @return the LiftrBaseSingleSignOnProperties object itself. + */ + public LiftrBaseSingleSignOnProperties withSingleSignOnState(SingleSignOnStates singleSignOnState) { + this.singleSignOnState = singleSignOnState; + return this; + } + + /** + * Get the enterpriseAppId property: AAD enterprise application Id used to setup SSO. + * + * @return the enterpriseAppId value. + */ + public String enterpriseAppId() { + return this.enterpriseAppId; + } + + /** + * Set the enterpriseAppId property: AAD enterprise application Id used to setup SSO. + * + * @param enterpriseAppId the enterpriseAppId value to set. + * @return the LiftrBaseSingleSignOnProperties object itself. + */ + public LiftrBaseSingleSignOnProperties withEnterpriseAppId(String enterpriseAppId) { + this.enterpriseAppId = enterpriseAppId; + return this; + } + + /** + * Get the singleSignOnUrl property: URL for SSO to be used by the partner to redirect the user to their system. + * + * @return the singleSignOnUrl value. + */ + public String singleSignOnUrl() { + return this.singleSignOnUrl; + } + + /** + * Set the singleSignOnUrl property: URL for SSO to be used by the partner to redirect the user to their system. + * + * @param singleSignOnUrl the singleSignOnUrl value to set. + * @return the LiftrBaseSingleSignOnProperties object itself. + */ + public LiftrBaseSingleSignOnProperties withSingleSignOnUrl(String singleSignOnUrl) { + this.singleSignOnUrl = singleSignOnUrl; + return this; + } + + /** + * Get the aadDomains property: List of AAD domains fetched from Microsoft Graph for user. + * + * @return the aadDomains value. + */ + public List aadDomains() { + return this.aadDomains; + } + + /** + * Set the aadDomains property: List of AAD domains fetched from Microsoft Graph for user. + * + * @param aadDomains the aadDomains value to set. + * @return the LiftrBaseSingleSignOnProperties object itself. + */ + public LiftrBaseSingleSignOnProperties withAadDomains(List aadDomains) { + this.aadDomains = aadDomains; + return this; + } + + /** + * Get the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseUserDetails.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseUserDetails.java new file mode 100644 index 0000000000000..3d63d6a2efbc0 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseUserDetails.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * User details for an organization. + */ +@Fluent +public final class LiftrBaseUserDetails { + /* + * First name of the user + */ + @JsonProperty(value = "firstName", required = true) + private String firstName; + + /* + * Last name of the user + */ + @JsonProperty(value = "lastName", required = true) + private String lastName; + + /* + * Email address of the user + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /* + * User's principal name + */ + @JsonProperty(value = "upn") + private String upn; + + /* + * User's phone number + */ + @JsonProperty(value = "phoneNumber") + private String phoneNumber; + + /** + * Creates an instance of LiftrBaseUserDetails class. + */ + public LiftrBaseUserDetails() { + } + + /** + * Get the firstName property: First name of the user. + * + * @return the firstName value. + */ + public String firstName() { + return this.firstName; + } + + /** + * Set the firstName property: First name of the user. + * + * @param firstName the firstName value to set. + * @return the LiftrBaseUserDetails object itself. + */ + public LiftrBaseUserDetails withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get the lastName property: Last name of the user. + * + * @return the lastName value. + */ + public String lastName() { + return this.lastName; + } + + /** + * Set the lastName property: Last name of the user. + * + * @param lastName the lastName value to set. + * @return the LiftrBaseUserDetails object itself. + */ + public LiftrBaseUserDetails withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get the emailAddress property: Email address of the user. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: Email address of the user. + * + * @param emailAddress the emailAddress value to set. + * @return the LiftrBaseUserDetails object itself. + */ + public LiftrBaseUserDetails withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the upn property: User's principal name. + * + * @return the upn value. + */ + public String upn() { + return this.upn; + } + + /** + * Set the upn property: User's principal name. + * + * @param upn the upn value to set. + * @return the LiftrBaseUserDetails object itself. + */ + public LiftrBaseUserDetails withUpn(String upn) { + this.upn = upn; + return this; + } + + /** + * Get the phoneNumber property: User's phone number. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: User's phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the LiftrBaseUserDetails object itself. + */ + public LiftrBaseUserDetails withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (firstName() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property firstName in model LiftrBaseUserDetails")); + } + if (lastName() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property lastName in model LiftrBaseUserDetails")); + } + if (emailAddress() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property emailAddress in model LiftrBaseUserDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LiftrBaseUserDetails.class); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseUserDetailsUpdate.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseUserDetailsUpdate.java new file mode 100644 index 0000000000000..9fc2e76564803 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/LiftrBaseUserDetailsUpdate.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * User details for an organization. + */ +@Fluent +public final class LiftrBaseUserDetailsUpdate { + /* + * First name of the user + */ + @JsonProperty(value = "firstName") + private String firstName; + + /* + * Last name of the user + */ + @JsonProperty(value = "lastName") + private String lastName; + + /* + * Email address of the user + */ + @JsonProperty(value = "emailAddress") + private String emailAddress; + + /* + * User's principal name + */ + @JsonProperty(value = "upn") + private String upn; + + /* + * User's phone number + */ + @JsonProperty(value = "phoneNumber") + private String phoneNumber; + + /** + * Creates an instance of LiftrBaseUserDetailsUpdate class. + */ + public LiftrBaseUserDetailsUpdate() { + } + + /** + * Get the firstName property: First name of the user. + * + * @return the firstName value. + */ + public String firstName() { + return this.firstName; + } + + /** + * Set the firstName property: First name of the user. + * + * @param firstName the firstName value to set. + * @return the LiftrBaseUserDetailsUpdate object itself. + */ + public LiftrBaseUserDetailsUpdate withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get the lastName property: Last name of the user. + * + * @return the lastName value. + */ + public String lastName() { + return this.lastName; + } + + /** + * Set the lastName property: Last name of the user. + * + * @param lastName the lastName value to set. + * @return the LiftrBaseUserDetailsUpdate object itself. + */ + public LiftrBaseUserDetailsUpdate withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get the emailAddress property: Email address of the user. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: Email address of the user. + * + * @param emailAddress the emailAddress value to set. + * @return the LiftrBaseUserDetailsUpdate object itself. + */ + public LiftrBaseUserDetailsUpdate withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the upn property: User's principal name. + * + * @return the upn value. + */ + public String upn() { + return this.upn; + } + + /** + * Set the upn property: User's principal name. + * + * @param upn the upn value to set. + * @return the LiftrBaseUserDetailsUpdate object itself. + */ + public LiftrBaseUserDetailsUpdate withUpn(String upn) { + this.upn = upn; + return this; + } + + /** + * Get the phoneNumber property: User's phone number. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: User's phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the LiftrBaseUserDetailsUpdate object itself. + */ + public LiftrBaseUserDetailsUpdate withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ManagedServiceIdentity.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ManagedServiceIdentity.java new file mode 100644 index 0000000000000..73099a20e3071 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ManagedServiceIdentity.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + @JsonProperty(value = "type", required = true) + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys + * will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ + * userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided + * for a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ManagedServiceIdentityType.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ManagedServiceIdentityType.java new file mode 100644 index 0000000000000..00e09ed078cb0 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ManagedServiceIdentityType.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * Static value None for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * Static value SystemAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Static value UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Static value SystemAssigned, UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned, UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + @JsonCreator + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/MarketplaceSubscriptionStatus.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/MarketplaceSubscriptionStatus.java new file mode 100644 index 0000000000000..ca34f38cd931a --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/MarketplaceSubscriptionStatus.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Marketplace subscription status of a resource. + */ +public final class MarketplaceSubscriptionStatus extends ExpandableStringEnum { + /** + * Static value PendingFulfillmentStart for MarketplaceSubscriptionStatus. + */ + public static final MarketplaceSubscriptionStatus PENDING_FULFILLMENT_START = fromString("PendingFulfillmentStart"); + + /** + * Static value Subscribed for MarketplaceSubscriptionStatus. + */ + public static final MarketplaceSubscriptionStatus SUBSCRIBED = fromString("Subscribed"); + + /** + * Static value Suspended for MarketplaceSubscriptionStatus. + */ + public static final MarketplaceSubscriptionStatus SUSPENDED = fromString("Suspended"); + + /** + * Static value Unsubscribed for MarketplaceSubscriptionStatus. + */ + public static final MarketplaceSubscriptionStatus UNSUBSCRIBED = fromString("Unsubscribed"); + + /** + * Creates a new instance of MarketplaceSubscriptionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MarketplaceSubscriptionStatus() { + } + + /** + * Creates or finds a MarketplaceSubscriptionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MarketplaceSubscriptionStatus. + */ + @JsonCreator + public static MarketplaceSubscriptionStatus fromString(String name) { + return fromString(name, MarketplaceSubscriptionStatus.class); + } + + /** + * Gets known MarketplaceSubscriptionStatus values. + * + * @return known MarketplaceSubscriptionStatus values. + */ + public static Collection values() { + return values(MarketplaceSubscriptionStatus.class); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Operation.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Operation.java new file mode 100644 index 0000000000000..a69b152d59034 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.resourcemanager.astro.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.astro.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OperationDisplay.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OperationDisplay.java new file mode 100644 index 0000000000000..82ae8472af043 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OperationDisplay.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OperationListResult.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OperationListResult.java new file mode 100644 index 0000000000000..93d226cde8602 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OperationListResult.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.astro.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set + * of results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Operations.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Operations.java new file mode 100644 index 0000000000000..aabe71a2007c9 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResource.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResource.java new file mode 100644 index 0000000000000..6879f7ea99f04 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResource.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.astro.fluent.models.OrganizationResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of OrganizationResource. + */ +public interface OrganizationResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + LiftrBaseDataOrganizationProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.astro.fluent.models.OrganizationResourceInner object. + * + * @return the inner object. + */ + OrganizationResourceInner innerModel(); + + /** + * The entirety of the OrganizationResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The OrganizationResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the OrganizationResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the OrganizationResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the OrganizationResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the OrganizationResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + OrganizationResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + OrganizationResource create(Context context); + } + + /** + * The stage of the OrganizationResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the OrganizationResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(LiftrBaseDataOrganizationProperties properties); + } + + /** + * The stage of the OrganizationResource definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Begins update for the OrganizationResource resource. + * + * @return the stage of resource update. + */ + OrganizationResource.Update update(); + + /** + * The template for OrganizationResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + OrganizationResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + OrganizationResource apply(Context context); + } + + /** + * The OrganizationResource update stages. + */ + interface UpdateStages { + /** + * The stage of the OrganizationResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the OrganizationResource update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the OrganizationResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The updatable properties of the OrganizationResource.. + * + * @param properties The updatable properties of the OrganizationResource. + * @return the next definition stage. + */ + Update withProperties(OrganizationResourceUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + OrganizationResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + OrganizationResource refresh(Context context); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResourceListResult.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResourceListResult.java new file mode 100644 index 0000000000000..210b2ed992fd3 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResourceListResult.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.astro.fluent.models.OrganizationResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a OrganizationResource list operation. + */ +@Fluent +public final class OrganizationResourceListResult { + /* + * The OrganizationResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Creates an instance of OrganizationResourceListResult class. + */ + public OrganizationResourceListResult() { + } + + /** + * Get the value property: The OrganizationResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The OrganizationResource items on this page. + * + * @param value the value value to set. + * @return the OrganizationResourceListResult object itself. + */ + public OrganizationResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the OrganizationResourceListResult object itself. + */ + public OrganizationResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property value in model OrganizationResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OrganizationResourceListResult.class); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResourceUpdate.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResourceUpdate.java new file mode 100644 index 0000000000000..f6a3085964b79 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResourceUpdate.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * The type used for update operations of the OrganizationResource. + */ +@Fluent +public final class OrganizationResourceUpdate { + /* + * The managed service identities assigned to this resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The updatable properties of the OrganizationResource. + */ + @JsonProperty(value = "properties") + private OrganizationResourceUpdateProperties properties; + + /** + * Creates an instance of OrganizationResourceUpdate class. + */ + public OrganizationResourceUpdate() { + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the OrganizationResourceUpdate object itself. + */ + public OrganizationResourceUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the OrganizationResourceUpdate object itself. + */ + public OrganizationResourceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The updatable properties of the OrganizationResource. + * + * @return the properties value. + */ + public OrganizationResourceUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The updatable properties of the OrganizationResource. + * + * @param properties the properties value to set. + * @return the OrganizationResourceUpdate object itself. + */ + public OrganizationResourceUpdate withProperties(OrganizationResourceUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResourceUpdateProperties.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResourceUpdateProperties.java new file mode 100644 index 0000000000000..ab455945448b0 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/OrganizationResourceUpdateProperties.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The updatable properties of the OrganizationResource. + */ +@Fluent +public final class OrganizationResourceUpdateProperties { + /* + * Details of the user. + */ + @JsonProperty(value = "user") + private LiftrBaseUserDetailsUpdate user; + + /* + * Organization properties + */ + @JsonProperty(value = "partnerOrganizationProperties") + private LiftrBaseDataPartnerOrganizationPropertiesUpdate partnerOrganizationProperties; + + /** + * Creates an instance of OrganizationResourceUpdateProperties class. + */ + public OrganizationResourceUpdateProperties() { + } + + /** + * Get the user property: Details of the user. + * + * @return the user value. + */ + public LiftrBaseUserDetailsUpdate user() { + return this.user; + } + + /** + * Set the user property: Details of the user. + * + * @param user the user value to set. + * @return the OrganizationResourceUpdateProperties object itself. + */ + public OrganizationResourceUpdateProperties withUser(LiftrBaseUserDetailsUpdate user) { + this.user = user; + return this; + } + + /** + * Get the partnerOrganizationProperties property: Organization properties. + * + * @return the partnerOrganizationProperties value. + */ + public LiftrBaseDataPartnerOrganizationPropertiesUpdate partnerOrganizationProperties() { + return this.partnerOrganizationProperties; + } + + /** + * Set the partnerOrganizationProperties property: Organization properties. + * + * @param partnerOrganizationProperties the partnerOrganizationProperties value to set. + * @return the OrganizationResourceUpdateProperties object itself. + */ + public OrganizationResourceUpdateProperties withPartnerOrganizationProperties( + LiftrBaseDataPartnerOrganizationPropertiesUpdate partnerOrganizationProperties) { + this.partnerOrganizationProperties = partnerOrganizationProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (user() != null) { + user().validate(); + } + if (partnerOrganizationProperties() != null) { + partnerOrganizationProperties().validate(); + } + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Organizations.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Organizations.java new file mode 100644 index 0000000000000..22ae52870bb7a --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Organizations.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Organizations. + */ +public interface Organizations { + /** + * List OrganizationResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List OrganizationResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String organizationName, + Context context); + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource. + */ + OrganizationResource getByResourceGroup(String resourceGroupName, String organizationName); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String organizationName); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationName Name of the Organizations resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String organizationName, Context context); + + /** + * Get a OrganizationResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response}. + */ + OrganizationResource getById(String id); + + /** + * Get a OrganizationResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a OrganizationResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a OrganizationResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new OrganizationResource resource. + * + * @param name resource name. + * @return the first stage of the new OrganizationResource definition. + */ + OrganizationResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Origin.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Origin.java new file mode 100644 index 0000000000000..4b01876908736 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/Origin.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ResourceProvisioningState.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ResourceProvisioningState.java new file mode 100644 index 0000000000000..8c3c3711f1883 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/ResourceProvisioningState.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The provisioning state of a resource type. + */ +public final class ResourceProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ResourceProvisioningState. + */ + public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ResourceProvisioningState. + */ + public static final ResourceProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ResourceProvisioningState. + */ + public static final ResourceProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ResourceProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceProvisioningState() { + } + + /** + * Creates or finds a ResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceProvisioningState. + */ + @JsonCreator + public static ResourceProvisioningState fromString(String name) { + return fromString(name, ResourceProvisioningState.class); + } + + /** + * Gets known ResourceProvisioningState values. + * + * @return known ResourceProvisioningState values. + */ + public static Collection values() { + return values(ResourceProvisioningState.class); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/SingleSignOnStates.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/SingleSignOnStates.java new file mode 100644 index 0000000000000..202c211d3bf0f --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/SingleSignOnStates.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Various states of the SSO resource. + */ +public final class SingleSignOnStates extends ExpandableStringEnum { + /** + * Static value Initial for SingleSignOnStates. + */ + public static final SingleSignOnStates INITIAL = fromString("Initial"); + + /** + * Static value Enable for SingleSignOnStates. + */ + public static final SingleSignOnStates ENABLE = fromString("Enable"); + + /** + * Static value Disable for SingleSignOnStates. + */ + public static final SingleSignOnStates DISABLE = fromString("Disable"); + + /** + * Creates a new instance of SingleSignOnStates value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SingleSignOnStates() { + } + + /** + * Creates or finds a SingleSignOnStates from its string representation. + * + * @param name a name to look for. + * @return the corresponding SingleSignOnStates. + */ + @JsonCreator + public static SingleSignOnStates fromString(String name) { + return fromString(name, SingleSignOnStates.class); + } + + /** + * Gets known SingleSignOnStates values. + * + * @return known SingleSignOnStates values. + */ + public static Collection values() { + return values(SingleSignOnStates.class); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/UserAssignedIdentity.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/UserAssignedIdentity.java new file mode 100644 index 0000000000000..4a1a345ac1dc1 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/UserAssignedIdentity.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity { + /* + * The principal ID of the assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/package-info.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/package-info.java new file mode 100644 index 0000000000000..2ea4d9621ca44 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for AstroMgmtClient. + * null. + */ +package com.azure.resourcemanager.astro.models; diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/package-info.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/package-info.java new file mode 100644 index 0000000000000..ac144c676d7e0 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/com/azure/resourcemanager/astro/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for AstroMgmtClient. + * null. + */ +package com.azure.resourcemanager.astro; diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/java/module-info.java b/sdk/astro/azure-resourcemanager-astro/src/main/java/module-info.java new file mode 100644 index 0000000000000..bf66eb6157b67 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.astro { + requires transitive com.azure.core.management; + exports com.azure.resourcemanager.astro; + exports com.azure.resourcemanager.astro.fluent; + exports com.azure.resourcemanager.astro.fluent.models; + exports com.azure.resourcemanager.astro.models; + opens com.azure.resourcemanager.astro.fluent.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.astro.models to com.azure.core, com.fasterxml.jackson.databind; +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-astro/proxy-config.json b/sdk/astro/azure-resourcemanager-astro/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-astro/proxy-config.json new file mode 100644 index 0000000000000..070f77c390db7 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-astro/proxy-config.json @@ -0,0 +1 @@ +[ [ "com.azure.resourcemanager.astro.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.astro.implementation.OrganizationsClientImpl$OrganizationsService" ] ] \ No newline at end of file diff --git a/sdk/astro/azure-resourcemanager-astro/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-astro/reflect-config.json b/sdk/astro/azure-resourcemanager-astro/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-astro/reflect-config.json new file mode 100644 index 0000000000000..9c170b9335729 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-astro/reflect-config.json @@ -0,0 +1,116 @@ +[ { + "name" : "com.azure.resourcemanager.astro.models.OperationListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.fluent.models.OperationInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.OperationDisplay", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.OrganizationResourceListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.fluent.models.OrganizationResourceInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.LiftrBaseDataOrganizationProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.LiftrBaseMarketplaceDetails", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.LiftrBaseOfferDetails", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.LiftrBaseUserDetails", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.ManagedServiceIdentity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.UserAssignedIdentity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.OrganizationResourceUpdate", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.OrganizationResourceUpdateProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.LiftrBaseUserDetailsUpdate", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationPropertiesUpdate", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.Origin", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.ActionType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.ResourceProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.SingleSignOnStates", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.astro.models.ManagedServiceIdentityType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +} ] \ No newline at end of file diff --git a/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OperationsListSamples.java b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..2bbb53fc802a2 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void operationsListGeneratedByMaximumSetRule(com.azure.resourcemanager.astro.AstroManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsCreateOrUpdateSamples.java b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0d9d2173e0039 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsCreateOrUpdateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.resourcemanager.astro.models.LiftrBaseDataOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseMarketplaceDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseOfferDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetails; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Organizations CreateOrUpdate. + */ +public final class OrganizationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_CreateOrUpdate - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void + organizationsCreateOrUpdateGeneratedByMaximumSetRule(com.azure.resourcemanager.astro.AstroManager manager) { + manager.organizations().define("U.1-:7").withRegion("mhqthlsatwvqkl").withExistingResourceGroup("rgastronomer") + .withTags(mapOf()) + .withProperties(new LiftrBaseDataOrganizationProperties() + .withMarketplace(new LiftrBaseMarketplaceDetails().withSubscriptionId("ntthclydlpqmasr") + .withSubscriptionStatus(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START) + .withOfferDetails(new LiftrBaseOfferDetails().withPublisherId("gfsqxygpnerxmvols") + .withOfferId("krzkefmpxztqyusidzgpchfaswuyce").withPlanId("kndxzygsanuiqzwbfbbvoipv") + .withPlanName("pwqjwlq").withTermUnit("xyygyzcazkuelz").withTermId("pwds"))) + .withUser(new LiftrBaseUserDetails().withFirstName("nfh").withLastName("lazfbstcccykibvcrxpmglqam") + .withEmailAddress(".K_@e7N-g1.xjqnbPs").withUpn("xtutvycpxjrtoftx").withPhoneNumber("inxkscllh")) + .withPartnerOrganizationProperties( + new LiftrBaseDataPartnerOrganizationProperties().withOrganizationId("lskgzdmziusgrsucv") + .withWorkspaceId("vcrupxwpaba").withOrganizationName("3-").withWorkspaceName("9.:06") + .withSingleSignOnProperties(new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL).withEnterpriseAppId("mklfypyujwumgwdzae") + .withSingleSignOnUrl("ymmtzkyghvinvhgnqlzwrr").withAadDomains(Arrays.asList("kfbleh"))))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsDeleteSamples.java b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsDeleteSamples.java new file mode 100644 index 0000000000000..8d93a8f7e217f --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +/** + * Samples for Organizations Delete. + */ +public final class OrganizationsDeleteSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Delete - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void + organizationsDeleteGeneratedByMaximumSetRule(com.azure.resourcemanager.astro.AstroManager manager) { + manager.organizations().delete("rgastronomer", "q:", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsGetByResourceGroupSamples.java b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..e950f378a5aef --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +/** + * Samples for Organizations GetByResourceGroup. + */ +public final class OrganizationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Get - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void organizationsGetGeneratedByMaximumSetRule(com.azure.resourcemanager.astro.AstroManager manager) { + manager.organizations().getByResourceGroupWithResponse("rgastronomer", "S PS", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsListByResourceGroupSamples.java b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..c12840918fc50 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsListByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +/** + * Samples for Organizations ListByResourceGroup. + */ +public final class OrganizationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_ListByResourceGroup - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void organizationsListByResourceGroupGeneratedByMaximumSetRule( + com.azure.resourcemanager.astro.AstroManager manager) { + manager.organizations().listByResourceGroup("rgastronomer", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsListSamples.java b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsListSamples.java new file mode 100644 index 0000000000000..c4bef2f958930 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +/** + * Samples for Organizations List. + */ +public final class OrganizationsListSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_ListBySubscription - generated by [MaximumSet] rule. + * + * @param manager Entry point to AstroManager. + */ + public static void + organizationsListBySubscriptionGeneratedByMaximumSetRule(com.azure.resourcemanager.astro.AstroManager manager) { + manager.organizations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsUpdateSamples.java b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsUpdateSamples.java new file mode 100644 index 0000000000000..dff8ca7221468 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/samples/java/com/azure/resourcemanager/astro/generated/OrganizationsUpdateSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationPropertiesUpdate; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetailsUpdate; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.OrganizationResource; +import com.azure.resourcemanager.astro.models.OrganizationResourceUpdateProperties; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Organizations Update. + */ +public final class OrganizationsUpdateSamples { + /* + * x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/ + * Organizations_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Update. + * + * @param manager Entry point to AstroManager. + */ + public static void organizationsUpdate(com.azure.resourcemanager.astro.AstroManager manager) { + OrganizationResource resource = manager.organizations() + .getByResourceGroupWithResponse("rgastronomer", "6.", com.azure.core.util.Context.NONE).getValue(); + resource.update().withTags(mapOf("key1474", "fakeTokenPlaceholder")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .withProperties(new OrganizationResourceUpdateProperties() + .withUser(new LiftrBaseUserDetailsUpdate().withFirstName("qeuofehzypzljgcuysugefbgxde") + .withLastName("g").withEmailAddress(".K_@e7N-g1.xjqnbPs").withUpn("uwtprzdfpsqmktx") + .withPhoneNumber("aqpyxznvqpgkzohevynofrjdfgoo")) + .withPartnerOrganizationProperties(new LiftrBaseDataPartnerOrganizationPropertiesUpdate() + .withOrganizationId("lrtmbkvyvvoszhjevohkmyjhfyty").withWorkspaceId("xsepuskdhejaadusyxq") + .withOrganizationName("U2P_").withWorkspaceName("L.-y_--:") + .withSingleSignOnProperties(new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL).withEnterpriseAppId("mklfypyujwumgwdzae") + .withSingleSignOnUrl("ymmtzkyghvinvhgnqlzwrr").withAadDomains(Arrays.asList("kfbleh"))))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseDataOrganizationPropertiesTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseDataOrganizationPropertiesTests.java new file mode 100644 index 0000000000000..e267a7bbc2f29 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseDataOrganizationPropertiesTests.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.LiftrBaseDataOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseMarketplaceDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseOfferDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetails; +import com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class LiftrBaseDataOrganizationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LiftrBaseDataOrganizationProperties model = BinaryData.fromString( + "{\"marketplace\":{\"subscriptionId\":\"ytb\",\"subscriptionStatus\":\"PendingFulfillmentStart\",\"offerDetails\":{\"publisherId\":\"fouflmmnkzsmo\",\"offerId\":\"mglougpbkw\",\"planId\":\"mutduqktaps\",\"planName\":\"gcue\",\"termUnit\":\"umkdosvqwhbmd\",\"termId\":\"bjf\"}},\"user\":{\"firstName\":\"dgmb\",\"lastName\":\"bexppb\",\"emailAddress\":\"tq\",\"upn\":\"ol\",\"phoneNumber\":\"fpsalgbqu\"},\"provisioningState\":\"Succeeded\",\"partnerOrganizationProperties\":{\"organizationId\":\"jgzjaoyfhrtx\",\"workspaceId\":\"n\",\"organizationName\":\"rkujy\",\"workspaceName\":\"l\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Disable\",\"enterpriseAppId\":\"qawrlyxwj\",\"singleSignOnUrl\":\"prbnwbxgjvtbv\",\"aadDomains\":[\"szdnr\",\"jq\"],\"provisioningState\":\"Canceled\"}}}") + .toObject(LiftrBaseDataOrganizationProperties.class); + Assertions.assertEquals("ytb", model.marketplace().subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START, + model.marketplace().subscriptionStatus()); + Assertions.assertEquals("fouflmmnkzsmo", model.marketplace().offerDetails().publisherId()); + Assertions.assertEquals("mglougpbkw", model.marketplace().offerDetails().offerId()); + Assertions.assertEquals("mutduqktaps", model.marketplace().offerDetails().planId()); + Assertions.assertEquals("gcue", model.marketplace().offerDetails().planName()); + Assertions.assertEquals("umkdosvqwhbmd", model.marketplace().offerDetails().termUnit()); + Assertions.assertEquals("bjf", model.marketplace().offerDetails().termId()); + Assertions.assertEquals("dgmb", model.user().firstName()); + Assertions.assertEquals("bexppb", model.user().lastName()); + Assertions.assertEquals("tq", model.user().emailAddress()); + Assertions.assertEquals("ol", model.user().upn()); + Assertions.assertEquals("fpsalgbqu", model.user().phoneNumber()); + Assertions.assertEquals("jgzjaoyfhrtx", model.partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("n", model.partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("rkujy", model.partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("l", model.partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, + model.partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("qawrlyxwj", + model.partnerOrganizationProperties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("prbnwbxgjvtbv", + model.partnerOrganizationProperties().singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("szdnr", + model.partnerOrganizationProperties().singleSignOnProperties().aadDomains().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LiftrBaseDataOrganizationProperties model = new LiftrBaseDataOrganizationProperties() + .withMarketplace(new LiftrBaseMarketplaceDetails().withSubscriptionId("ytb") + .withSubscriptionStatus(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START) + .withOfferDetails(new LiftrBaseOfferDetails().withPublisherId("fouflmmnkzsmo").withOfferId("mglougpbkw") + .withPlanId("mutduqktaps").withPlanName("gcue").withTermUnit("umkdosvqwhbmd").withTermId("bjf"))) + .withUser(new LiftrBaseUserDetails().withFirstName("dgmb").withLastName("bexppb").withEmailAddress("tq") + .withUpn("ol").withPhoneNumber("fpsalgbqu")) + .withPartnerOrganizationProperties( + new LiftrBaseDataPartnerOrganizationProperties().withOrganizationId("jgzjaoyfhrtx").withWorkspaceId("n") + .withOrganizationName("rkujy").withWorkspaceName("l") + .withSingleSignOnProperties(new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.DISABLE).withEnterpriseAppId("qawrlyxwj") + .withSingleSignOnUrl("prbnwbxgjvtbv").withAadDomains(Arrays.asList("szdnr", "jq")))); + model = BinaryData.fromObject(model).toObject(LiftrBaseDataOrganizationProperties.class); + Assertions.assertEquals("ytb", model.marketplace().subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START, + model.marketplace().subscriptionStatus()); + Assertions.assertEquals("fouflmmnkzsmo", model.marketplace().offerDetails().publisherId()); + Assertions.assertEquals("mglougpbkw", model.marketplace().offerDetails().offerId()); + Assertions.assertEquals("mutduqktaps", model.marketplace().offerDetails().planId()); + Assertions.assertEquals("gcue", model.marketplace().offerDetails().planName()); + Assertions.assertEquals("umkdosvqwhbmd", model.marketplace().offerDetails().termUnit()); + Assertions.assertEquals("bjf", model.marketplace().offerDetails().termId()); + Assertions.assertEquals("dgmb", model.user().firstName()); + Assertions.assertEquals("bexppb", model.user().lastName()); + Assertions.assertEquals("tq", model.user().emailAddress()); + Assertions.assertEquals("ol", model.user().upn()); + Assertions.assertEquals("fpsalgbqu", model.user().phoneNumber()); + Assertions.assertEquals("jgzjaoyfhrtx", model.partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("n", model.partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("rkujy", model.partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("l", model.partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, + model.partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("qawrlyxwj", + model.partnerOrganizationProperties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("prbnwbxgjvtbv", + model.partnerOrganizationProperties().singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("szdnr", + model.partnerOrganizationProperties().singleSignOnProperties().aadDomains().get(0)); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseDataPartnerOrganizationPropertiesTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseDataPartnerOrganizationPropertiesTests.java new file mode 100644 index 0000000000000..ddb329bc341ba --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseDataPartnerOrganizationPropertiesTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class LiftrBaseDataPartnerOrganizationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LiftrBaseDataPartnerOrganizationProperties model = BinaryData.fromString( + "{\"organizationId\":\"fiyipjxsqwpgrj\",\"workspaceId\":\"norcjxvsnbyxqab\",\"organizationName\":\"mocpc\",\"workspaceName\":\"hurzafblj\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Disable\",\"enterpriseAppId\":\"oq\",\"singleSignOnUrl\":\"mkljavb\",\"aadDomains\":[\"tqajzyulpkudjkrl\",\"hbzhfepg\",\"gqexzlocxs\",\"paierh\"],\"provisioningState\":\"Failed\"}}") + .toObject(LiftrBaseDataPartnerOrganizationProperties.class); + Assertions.assertEquals("fiyipjxsqwpgrj", model.organizationId()); + Assertions.assertEquals("norcjxvsnbyxqab", model.workspaceId()); + Assertions.assertEquals("mocpc", model.organizationName()); + Assertions.assertEquals("hurzafblj", model.workspaceName()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, model.singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("oq", model.singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("mkljavb", model.singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("tqajzyulpkudjkrl", model.singleSignOnProperties().aadDomains().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LiftrBaseDataPartnerOrganizationProperties model = new LiftrBaseDataPartnerOrganizationProperties() + .withOrganizationId("fiyipjxsqwpgrj").withWorkspaceId("norcjxvsnbyxqab").withOrganizationName("mocpc") + .withWorkspaceName("hurzafblj").withSingleSignOnProperties( + new LiftrBaseSingleSignOnProperties().withSingleSignOnState(SingleSignOnStates.DISABLE) + .withEnterpriseAppId("oq").withSingleSignOnUrl("mkljavb") + .withAadDomains(Arrays.asList("tqajzyulpkudjkrl", "hbzhfepg", "gqexzlocxs", "paierh"))); + model = BinaryData.fromObject(model).toObject(LiftrBaseDataPartnerOrganizationProperties.class); + Assertions.assertEquals("fiyipjxsqwpgrj", model.organizationId()); + Assertions.assertEquals("norcjxvsnbyxqab", model.workspaceId()); + Assertions.assertEquals("mocpc", model.organizationName()); + Assertions.assertEquals("hurzafblj", model.workspaceName()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, model.singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("oq", model.singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("mkljavb", model.singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("tqajzyulpkudjkrl", model.singleSignOnProperties().aadDomains().get(0)); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseDataPartnerOrganizationPropertiesUpdateTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseDataPartnerOrganizationPropertiesUpdateTests.java new file mode 100644 index 0000000000000..c602ef014310c --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseDataPartnerOrganizationPropertiesUpdateTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationPropertiesUpdate; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class LiftrBaseDataPartnerOrganizationPropertiesUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LiftrBaseDataPartnerOrganizationPropertiesUpdate model = BinaryData.fromString( + "{\"organizationId\":\"gual\",\"workspaceId\":\"xxhejjzzvd\",\"organizationName\":\"gwdslfhotwm\",\"workspaceName\":\"npwlbjnpg\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Enable\",\"enterpriseAppId\":\"dehxnltyfsoppu\",\"singleSignOnUrl\":\"esnzwde\",\"aadDomains\":[\"vorxzdmohct\"],\"provisioningState\":\"Canceled\"}}") + .toObject(LiftrBaseDataPartnerOrganizationPropertiesUpdate.class); + Assertions.assertEquals("gual", model.organizationId()); + Assertions.assertEquals("xxhejjzzvd", model.workspaceId()); + Assertions.assertEquals("gwdslfhotwm", model.organizationName()); + Assertions.assertEquals("npwlbjnpg", model.workspaceName()); + Assertions.assertEquals(SingleSignOnStates.ENABLE, model.singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("dehxnltyfsoppu", model.singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("esnzwde", model.singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("vorxzdmohct", model.singleSignOnProperties().aadDomains().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LiftrBaseDataPartnerOrganizationPropertiesUpdate model + = new LiftrBaseDataPartnerOrganizationPropertiesUpdate().withOrganizationId("gual") + .withWorkspaceId("xxhejjzzvd").withOrganizationName("gwdslfhotwm").withWorkspaceName("npwlbjnpg") + .withSingleSignOnProperties(new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.ENABLE).withEnterpriseAppId("dehxnltyfsoppu") + .withSingleSignOnUrl("esnzwde").withAadDomains(Arrays.asList("vorxzdmohct"))); + model = BinaryData.fromObject(model).toObject(LiftrBaseDataPartnerOrganizationPropertiesUpdate.class); + Assertions.assertEquals("gual", model.organizationId()); + Assertions.assertEquals("xxhejjzzvd", model.workspaceId()); + Assertions.assertEquals("gwdslfhotwm", model.organizationName()); + Assertions.assertEquals("npwlbjnpg", model.workspaceName()); + Assertions.assertEquals(SingleSignOnStates.ENABLE, model.singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("dehxnltyfsoppu", model.singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("esnzwde", model.singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("vorxzdmohct", model.singleSignOnProperties().aadDomains().get(0)); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseMarketplaceDetailsTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseMarketplaceDetailsTests.java new file mode 100644 index 0000000000000..ec5d12041d949 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseMarketplaceDetailsTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.LiftrBaseMarketplaceDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseOfferDetails; +import com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus; +import org.junit.jupiter.api.Assertions; + +public final class LiftrBaseMarketplaceDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LiftrBaseMarketplaceDetails model = BinaryData.fromString( + "{\"subscriptionId\":\"muouqfp\",\"subscriptionStatus\":\"PendingFulfillmentStart\",\"offerDetails\":{\"publisherId\":\"wbnguitnwui\",\"offerId\":\"gazxuf\",\"planId\":\"zuckyfi\",\"planName\":\"fidfvzw\",\"termUnit\":\"uht\",\"termId\":\"wisdkft\"}}") + .toObject(LiftrBaseMarketplaceDetails.class); + Assertions.assertEquals("muouqfp", model.subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START, model.subscriptionStatus()); + Assertions.assertEquals("wbnguitnwui", model.offerDetails().publisherId()); + Assertions.assertEquals("gazxuf", model.offerDetails().offerId()); + Assertions.assertEquals("zuckyfi", model.offerDetails().planId()); + Assertions.assertEquals("fidfvzw", model.offerDetails().planName()); + Assertions.assertEquals("uht", model.offerDetails().termUnit()); + Assertions.assertEquals("wisdkft", model.offerDetails().termId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LiftrBaseMarketplaceDetails model = new LiftrBaseMarketplaceDetails().withSubscriptionId("muouqfp") + .withSubscriptionStatus(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START) + .withOfferDetails(new LiftrBaseOfferDetails().withPublisherId("wbnguitnwui").withOfferId("gazxuf") + .withPlanId("zuckyfi").withPlanName("fidfvzw").withTermUnit("uht").withTermId("wisdkft")); + model = BinaryData.fromObject(model).toObject(LiftrBaseMarketplaceDetails.class); + Assertions.assertEquals("muouqfp", model.subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START, model.subscriptionStatus()); + Assertions.assertEquals("wbnguitnwui", model.offerDetails().publisherId()); + Assertions.assertEquals("gazxuf", model.offerDetails().offerId()); + Assertions.assertEquals("zuckyfi", model.offerDetails().planId()); + Assertions.assertEquals("fidfvzw", model.offerDetails().planName()); + Assertions.assertEquals("uht", model.offerDetails().termUnit()); + Assertions.assertEquals("wisdkft", model.offerDetails().termId()); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseOfferDetailsTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseOfferDetailsTests.java new file mode 100644 index 0000000000000..4b2606233a76a --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseOfferDetailsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.LiftrBaseOfferDetails; +import org.junit.jupiter.api.Assertions; + +public final class LiftrBaseOfferDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LiftrBaseOfferDetails model = BinaryData.fromString( + "{\"publisherId\":\"wxmnteiwao\",\"offerId\":\"vkmijcmmxdcuf\",\"planId\":\"fsrpymzidnse\",\"planName\":\"xtbzsgfyccsne\",\"termUnit\":\"dwzjeiach\",\"termId\":\"osfln\"}") + .toObject(LiftrBaseOfferDetails.class); + Assertions.assertEquals("wxmnteiwao", model.publisherId()); + Assertions.assertEquals("vkmijcmmxdcuf", model.offerId()); + Assertions.assertEquals("fsrpymzidnse", model.planId()); + Assertions.assertEquals("xtbzsgfyccsne", model.planName()); + Assertions.assertEquals("dwzjeiach", model.termUnit()); + Assertions.assertEquals("osfln", model.termId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LiftrBaseOfferDetails model + = new LiftrBaseOfferDetails().withPublisherId("wxmnteiwao").withOfferId("vkmijcmmxdcuf") + .withPlanId("fsrpymzidnse").withPlanName("xtbzsgfyccsne").withTermUnit("dwzjeiach").withTermId("osfln"); + model = BinaryData.fromObject(model).toObject(LiftrBaseOfferDetails.class); + Assertions.assertEquals("wxmnteiwao", model.publisherId()); + Assertions.assertEquals("vkmijcmmxdcuf", model.offerId()); + Assertions.assertEquals("fsrpymzidnse", model.planId()); + Assertions.assertEquals("xtbzsgfyccsne", model.planName()); + Assertions.assertEquals("dwzjeiach", model.termUnit()); + Assertions.assertEquals("osfln", model.termId()); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseSingleSignOnPropertiesTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseSingleSignOnPropertiesTests.java new file mode 100644 index 0000000000000..ca1b2badcdef1 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseSingleSignOnPropertiesTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class LiftrBaseSingleSignOnPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LiftrBaseSingleSignOnProperties model = BinaryData.fromString( + "{\"singleSignOnState\":\"Enable\",\"enterpriseAppId\":\"ummajtjaod\",\"singleSignOnUrl\":\"bnbdxkqpxokajion\",\"aadDomains\":[\"ex\",\"stxgc\",\"odgmaajrmvdjwz\"],\"provisioningState\":\"Canceled\"}") + .toObject(LiftrBaseSingleSignOnProperties.class); + Assertions.assertEquals(SingleSignOnStates.ENABLE, model.singleSignOnState()); + Assertions.assertEquals("ummajtjaod", model.enterpriseAppId()); + Assertions.assertEquals("bnbdxkqpxokajion", model.singleSignOnUrl()); + Assertions.assertEquals("ex", model.aadDomains().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LiftrBaseSingleSignOnProperties model = new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.ENABLE).withEnterpriseAppId("ummajtjaod") + .withSingleSignOnUrl("bnbdxkqpxokajion").withAadDomains(Arrays.asList("ex", "stxgc", "odgmaajrmvdjwz")); + model = BinaryData.fromObject(model).toObject(LiftrBaseSingleSignOnProperties.class); + Assertions.assertEquals(SingleSignOnStates.ENABLE, model.singleSignOnState()); + Assertions.assertEquals("ummajtjaod", model.enterpriseAppId()); + Assertions.assertEquals("bnbdxkqpxokajion", model.singleSignOnUrl()); + Assertions.assertEquals("ex", model.aadDomains().get(0)); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseUserDetailsTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseUserDetailsTests.java new file mode 100644 index 0000000000000..2a71648e8110c --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseUserDetailsTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetails; +import org.junit.jupiter.api.Assertions; + +public final class LiftrBaseUserDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LiftrBaseUserDetails model = BinaryData.fromString( + "{\"firstName\":\"osfqpteehzzv\",\"lastName\":\"pyqr\",\"emailAddress\":\"mzinpvswjdk\",\"upn\":\"soodqxhcrmnoh\",\"phoneNumber\":\"ckwhds\"}") + .toObject(LiftrBaseUserDetails.class); + Assertions.assertEquals("osfqpteehzzv", model.firstName()); + Assertions.assertEquals("pyqr", model.lastName()); + Assertions.assertEquals("mzinpvswjdk", model.emailAddress()); + Assertions.assertEquals("soodqxhcrmnoh", model.upn()); + Assertions.assertEquals("ckwhds", model.phoneNumber()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LiftrBaseUserDetails model = new LiftrBaseUserDetails().withFirstName("osfqpteehzzv").withLastName("pyqr") + .withEmailAddress("mzinpvswjdk").withUpn("soodqxhcrmnoh").withPhoneNumber("ckwhds"); + model = BinaryData.fromObject(model).toObject(LiftrBaseUserDetails.class); + Assertions.assertEquals("osfqpteehzzv", model.firstName()); + Assertions.assertEquals("pyqr", model.lastName()); + Assertions.assertEquals("mzinpvswjdk", model.emailAddress()); + Assertions.assertEquals("soodqxhcrmnoh", model.upn()); + Assertions.assertEquals("ckwhds", model.phoneNumber()); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseUserDetailsUpdateTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseUserDetailsUpdateTests.java new file mode 100644 index 0000000000000..4603d2b9a40db --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/LiftrBaseUserDetailsUpdateTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetailsUpdate; +import org.junit.jupiter.api.Assertions; + +public final class LiftrBaseUserDetailsUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LiftrBaseUserDetailsUpdate model = BinaryData.fromString( + "{\"firstName\":\"bonqvpkvlrxnjeas\",\"lastName\":\"pheoflokeyy\",\"emailAddress\":\"nj\",\"upn\":\"lwtgrhpdj\",\"phoneNumber\":\"umasxazjpq\"}") + .toObject(LiftrBaseUserDetailsUpdate.class); + Assertions.assertEquals("bonqvpkvlrxnjeas", model.firstName()); + Assertions.assertEquals("pheoflokeyy", model.lastName()); + Assertions.assertEquals("nj", model.emailAddress()); + Assertions.assertEquals("lwtgrhpdj", model.upn()); + Assertions.assertEquals("umasxazjpq", model.phoneNumber()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LiftrBaseUserDetailsUpdate model = new LiftrBaseUserDetailsUpdate().withFirstName("bonqvpkvlrxnjeas") + .withLastName("pheoflokeyy").withEmailAddress("nj").withUpn("lwtgrhpdj").withPhoneNumber("umasxazjpq"); + model = BinaryData.fromObject(model).toObject(LiftrBaseUserDetailsUpdate.class); + Assertions.assertEquals("bonqvpkvlrxnjeas", model.firstName()); + Assertions.assertEquals("pheoflokeyy", model.lastName()); + Assertions.assertEquals("nj", model.emailAddress()); + Assertions.assertEquals("lwtgrhpdj", model.upn()); + Assertions.assertEquals("umasxazjpq", model.phoneNumber()); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/ManagedServiceIdentityTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/ManagedServiceIdentityTests.java new file mode 100644 index 0000000000000..88ea1017a01cc --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"ba871653-783a-4112-94f3-f0ee24f4fb8b\",\"tenantId\":\"d3f8a658-ed33-4fae-b96c-b34b9d20ce00\",\"type\":\"SystemAssigned, UserAssigned\",\"userAssignedIdentities\":{\"j\":{\"principalId\":\"da91cbef-1718-46cc-82a5-17c645d02377\",\"clientId\":\"8165d87b-0f2e-40ff-980e-bc55c064ee92\"},\"jctbza\":{\"principalId\":\"eb5f00c6-e7d2-4644-bba5-99f74866c5d5\",\"clientId\":\"8940c25a-f3f5-4737-bbf4-ee361f89dc44\"},\"sycbkbfk\":{\"principalId\":\"92f4df9d-3855-4662-806b-89501444aedc\",\"clientId\":\"f3cfbe55-3af4-4772-976e-a6c4a96d7634\"},\"dkexxppofm\":{\"principalId\":\"07629af5-c039-4599-aa8c-2dce75dc1644\",\"clientId\":\"807da0f0-675e-4daa-b227-31390fef093d\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model + = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("j", new UserAssignedIdentity(), "jctbza", new UserAssignedIdentity(), + "sycbkbfk", new UserAssignedIdentity(), "dkexxppofm", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationDisplayTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationDisplayTests.java new file mode 100644 index 0000000000000..962da9b431e93 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationDisplayTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") + .toObject(OperationDisplay.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationDisplay model = new OperationDisplay(); + model = BinaryData.fromObject(model).toObject(OperationDisplay.class); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationInnerTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationInnerTests.java new file mode 100644 index 0000000000000..a935c8bf2d1fe --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationInnerTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.fluent.models.OperationInner; +import com.azure.resourcemanager.astro.models.OperationDisplay; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); + model = BinaryData.fromObject(model).toObject(OperationInner.class); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationListResultTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationListResultTests.java new file mode 100644 index 0000000000000..58a1198e5ffb2 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.OperationListResult; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") + .toObject(OperationListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationListResult model = new OperationListResult(); + model = BinaryData.fromObject(model).toObject(OperationListResult.class); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationsListMockTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationsListMockTests.java new file mode 100644 index 0000000000000..a167cb89c26c9 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OperationsListMockTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.astro.AstroManager; +import com.azure.resourcemanager.astro.models.Operation; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"name\":\"dwxdndnv\",\"isDataAction\":true,\"display\":{\"provider\":\"jugwdkcglhsl\",\"resource\":\"jdyggdtji\",\"operation\":\"b\",\"description\":\"ofqweykhmenevfye\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AstroManager manager = AstroManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceInnerTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceInnerTests.java new file mode 100644 index 0000000000000..514db2f544c40 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceInnerTests.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.astro.models.LiftrBaseDataOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseMarketplaceDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseOfferDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetails; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import com.azure.resourcemanager.astro.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationResourceInner model = BinaryData.fromString( + "{\"properties\":{\"marketplace\":{\"subscriptionId\":\"jofxqe\",\"subscriptionStatus\":\"PendingFulfillmentStart\",\"offerDetails\":{\"publisherId\":\"aeqjhqjbasvms\",\"offerId\":\"jqul\",\"planId\":\"gsntnbybkzgcwr\",\"planName\":\"lxxwrljdouskc\",\"termUnit\":\"kocrcjdkwtnhx\",\"termId\":\"jbiksqrglssai\"}},\"user\":{\"firstName\":\"qpjwnzlljfm\",\"lastName\":\"pee\",\"emailAddress\":\"vmgxsab\",\"upn\":\"qduujitcjczdz\",\"phoneNumber\":\"ndhkrw\"},\"provisioningState\":\"Failed\",\"partnerOrganizationProperties\":{\"organizationId\":\"dsbdkvwrwjf\",\"workspaceId\":\"snhu\",\"organizationName\":\"je\",\"workspaceName\":\"mrldhu\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Initial\",\"enterpriseAppId\":\"atqxho\",\"singleSignOnUrl\":\"geablgphuticndvk\",\"aadDomains\":[\"wyiftyhxhur\",\"k\",\"tyxolniwpwc\"],\"provisioningState\":\"Failed\"}}},\"identity\":{\"principalId\":\"5266b6b1-f132-4667-af22-219439f39985\",\"tenantId\":\"85f6f9c0-8a65-4fb4-b763-c5db4c67fe9f\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"lryplwckbasyy\":{\"principalId\":\"a01f29f8-275f-4483-bd4e-4cd4affdf1fe\",\"clientId\":\"67189864-bf71-4916-8df9-6f95146aab84\"}}},\"location\":\"ddhsgcbacphe\",\"tags\":{\"ndlik\":\"tynqgoul\"},\"id\":\"yqkgfg\",\"name\":\"bmadgak\",\"type\":\"qsrxybzqqed\"}") + .toObject(OrganizationResourceInner.class); + Assertions.assertEquals("ddhsgcbacphe", model.location()); + Assertions.assertEquals("tynqgoul", model.tags().get("ndlik")); + Assertions.assertEquals("jofxqe", model.properties().marketplace().subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START, + model.properties().marketplace().subscriptionStatus()); + Assertions.assertEquals("aeqjhqjbasvms", model.properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("jqul", model.properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("gsntnbybkzgcwr", model.properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("lxxwrljdouskc", model.properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("kocrcjdkwtnhx", model.properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("jbiksqrglssai", model.properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("qpjwnzlljfm", model.properties().user().firstName()); + Assertions.assertEquals("pee", model.properties().user().lastName()); + Assertions.assertEquals("vmgxsab", model.properties().user().emailAddress()); + Assertions.assertEquals("qduujitcjczdz", model.properties().user().upn()); + Assertions.assertEquals("ndhkrw", model.properties().user().phoneNumber()); + Assertions.assertEquals("dsbdkvwrwjf", model.properties().partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("snhu", model.properties().partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("je", model.properties().partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("mrldhu", model.properties().partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.INITIAL, + model.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("atqxho", + model.properties().partnerOrganizationProperties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("geablgphuticndvk", + model.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("wyiftyhxhur", + model.properties().partnerOrganizationProperties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationResourceInner model + = new OrganizationResourceInner().withLocation("ddhsgcbacphe").withTags(mapOf("ndlik", "tynqgoul")) + .withProperties(new LiftrBaseDataOrganizationProperties() + .withMarketplace(new LiftrBaseMarketplaceDetails().withSubscriptionId("jofxqe") + .withSubscriptionStatus(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START) + .withOfferDetails(new LiftrBaseOfferDetails().withPublisherId("aeqjhqjbasvms") + .withOfferId("jqul").withPlanId("gsntnbybkzgcwr").withPlanName("lxxwrljdouskc") + .withTermUnit("kocrcjdkwtnhx").withTermId("jbiksqrglssai"))) + .withUser(new LiftrBaseUserDetails().withFirstName("qpjwnzlljfm").withLastName("pee") + .withEmailAddress("vmgxsab").withUpn("qduujitcjczdz").withPhoneNumber("ndhkrw")) + .withPartnerOrganizationProperties(new LiftrBaseDataPartnerOrganizationProperties() + .withOrganizationId("dsbdkvwrwjf").withWorkspaceId("snhu").withOrganizationName("je") + .withWorkspaceName("mrldhu").withSingleSignOnProperties( + new LiftrBaseSingleSignOnProperties().withSingleSignOnState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("atqxho").withSingleSignOnUrl("geablgphuticndvk") + .withAadDomains(Arrays.asList("wyiftyhxhur", "k", "tyxolniwpwc"))))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf("lryplwckbasyy", new UserAssignedIdentity()))); + model = BinaryData.fromObject(model).toObject(OrganizationResourceInner.class); + Assertions.assertEquals("ddhsgcbacphe", model.location()); + Assertions.assertEquals("tynqgoul", model.tags().get("ndlik")); + Assertions.assertEquals("jofxqe", model.properties().marketplace().subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.PENDING_FULFILLMENT_START, + model.properties().marketplace().subscriptionStatus()); + Assertions.assertEquals("aeqjhqjbasvms", model.properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("jqul", model.properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("gsntnbybkzgcwr", model.properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("lxxwrljdouskc", model.properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("kocrcjdkwtnhx", model.properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("jbiksqrglssai", model.properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("qpjwnzlljfm", model.properties().user().firstName()); + Assertions.assertEquals("pee", model.properties().user().lastName()); + Assertions.assertEquals("vmgxsab", model.properties().user().emailAddress()); + Assertions.assertEquals("qduujitcjczdz", model.properties().user().upn()); + Assertions.assertEquals("ndhkrw", model.properties().user().phoneNumber()); + Assertions.assertEquals("dsbdkvwrwjf", model.properties().partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("snhu", model.properties().partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("je", model.properties().partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("mrldhu", model.properties().partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.INITIAL, + model.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("atqxho", + model.properties().partnerOrganizationProperties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("geablgphuticndvk", + model.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("wyiftyhxhur", + model.properties().partnerOrganizationProperties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceListResultTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceListResultTests.java new file mode 100644 index 0000000000000..d9b3522e23ef9 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceListResultTests.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.astro.models.LiftrBaseDataOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseMarketplaceDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseOfferDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetails; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.astro.models.OrganizationResourceListResult; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import com.azure.resourcemanager.astro.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"marketplace\":{\"subscriptionId\":\"git\",\"subscriptionStatus\":\"Unsubscribed\",\"offerDetails\":{\"publisherId\":\"hab\",\"offerId\":\"fpikxwczb\",\"planId\":\"scnpqxuhivy\",\"planName\":\"iwbybrkxvdumjg\",\"termUnit\":\"fwvuk\",\"termId\":\"audccsnhs\"}},\"user\":{\"firstName\":\"cnyejhkryhtnapcz\",\"lastName\":\"lokjyemkk\",\"emailAddress\":\"ni\",\"upn\":\"oxzjnchgejspod\",\"phoneNumber\":\"ilzyd\"},\"provisioningState\":\"Succeeded\",\"partnerOrganizationProperties\":{\"organizationId\":\"yahux\",\"workspaceId\":\"pmqnja\",\"organizationName\":\"wixjsprozvcp\",\"workspaceName\":\"eg\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Enable\",\"enterpriseAppId\":\"datscmd\",\"singleSignOnUrl\":\"jhulsuuvmkjo\",\"aadDomains\":[\"wfndiodjpsl\",\"ej\"],\"provisioningState\":\"Succeeded\"}}},\"identity\":{\"principalId\":\"f345d1dd-84ed-4137-a8ac-041c6e9263e8\",\"tenantId\":\"9206dbad-6511-4700-91b0-09e6654cabe4\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"acctazakljla\":{\"principalId\":\"5b8c2542-054a-4119-b929-2af73c1f7fff\",\"clientId\":\"971818de-3310-451d-95ac-61ea613d7ed9\"},\"ryffdfdosy\":{\"principalId\":\"68df7cb7-56e9-4eb6-b467-dd50504fea27\",\"clientId\":\"14dd993a-21c5-417e-bb85-9c31c083c79c\"},\"paojakhmsbzjh\":{\"principalId\":\"deba250f-1fa4-465c-9a2c-9c5221e004f8\",\"clientId\":\"738bf263-f59a-4f01-8001-207c1b17da42\"},\"evdphlxaol\":{\"principalId\":\"16fb1148-d6a2-4723-8dd4-01ee257f425f\",\"clientId\":\"43d63226-eaa0-40b1-bbbf-75b587043232\"}}},\"location\":\"qtrgqjbpfzfsinzg\",\"tags\":{\"j\":\"jrwzox\",\"fpjkjlxofp\":\"felluwfzitonpe\",\"uybbkpodep\":\"vhpfxxypininmay\",\"zxtheotusivyevcc\":\"oginuvamiheognar\"},\"id\":\"qi\",\"name\":\"nhungbw\",\"type\":\"zrnf\"}],\"nextLink\":\"xgispemvtzfkufu\"}") + .toObject(OrganizationResourceListResult.class); + Assertions.assertEquals("qtrgqjbpfzfsinzg", model.value().get(0).location()); + Assertions.assertEquals("jrwzox", model.value().get(0).tags().get("j")); + Assertions.assertEquals("git", model.value().get(0).properties().marketplace().subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.UNSUBSCRIBED, + model.value().get(0).properties().marketplace().subscriptionStatus()); + Assertions.assertEquals("hab", model.value().get(0).properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("fpikxwczb", model.value().get(0).properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("scnpqxuhivy", model.value().get(0).properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("iwbybrkxvdumjg", + model.value().get(0).properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("fwvuk", model.value().get(0).properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("audccsnhs", model.value().get(0).properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("cnyejhkryhtnapcz", model.value().get(0).properties().user().firstName()); + Assertions.assertEquals("lokjyemkk", model.value().get(0).properties().user().lastName()); + Assertions.assertEquals("ni", model.value().get(0).properties().user().emailAddress()); + Assertions.assertEquals("oxzjnchgejspod", model.value().get(0).properties().user().upn()); + Assertions.assertEquals("ilzyd", model.value().get(0).properties().user().phoneNumber()); + Assertions.assertEquals("yahux", + model.value().get(0).properties().partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("pmqnja", + model.value().get(0).properties().partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("wixjsprozvcp", + model.value().get(0).properties().partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("eg", + model.value().get(0).properties().partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.ENABLE, model.value().get(0).properties() + .partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("datscmd", model.value().get(0).properties().partnerOrganizationProperties() + .singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("jhulsuuvmkjo", model.value().get(0).properties().partnerOrganizationProperties() + .singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("wfndiodjpsl", model.value().get(0).properties().partnerOrganizationProperties() + .singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); + Assertions.assertEquals("xgispemvtzfkufu", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationResourceListResult model = new OrganizationResourceListResult() + .withValue(Arrays.asList(new OrganizationResourceInner().withLocation("qtrgqjbpfzfsinzg") + .withTags(mapOf("j", "jrwzox", "fpjkjlxofp", "felluwfzitonpe", "uybbkpodep", "vhpfxxypininmay", + "zxtheotusivyevcc", "oginuvamiheognar")) + .withProperties(new LiftrBaseDataOrganizationProperties() + .withMarketplace(new LiftrBaseMarketplaceDetails().withSubscriptionId("git") + .withSubscriptionStatus(MarketplaceSubscriptionStatus.UNSUBSCRIBED) + .withOfferDetails(new LiftrBaseOfferDetails().withPublisherId("hab").withOfferId("fpikxwczb") + .withPlanId("scnpqxuhivy").withPlanName("iwbybrkxvdumjg").withTermUnit("fwvuk") + .withTermId("audccsnhs"))) + .withUser(new LiftrBaseUserDetails().withFirstName("cnyejhkryhtnapcz").withLastName("lokjyemkk") + .withEmailAddress("ni").withUpn("oxzjnchgejspod").withPhoneNumber("ilzyd")) + .withPartnerOrganizationProperties(new LiftrBaseDataPartnerOrganizationProperties() + .withOrganizationId("yahux").withWorkspaceId("pmqnja").withOrganizationName("wixjsprozvcp") + .withWorkspaceName("eg") + .withSingleSignOnProperties(new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.ENABLE).withEnterpriseAppId("datscmd") + .withSingleSignOnUrl("jhulsuuvmkjo").withAadDomains(Arrays.asList("wfndiodjpsl", "ej"))))) + .withIdentity( + new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf("acctazakljla", new UserAssignedIdentity(), "ryffdfdosy", + new UserAssignedIdentity(), "paojakhmsbzjh", new UserAssignedIdentity(), "evdphlxaol", + new UserAssignedIdentity()))))) + .withNextLink("xgispemvtzfkufu"); + model = BinaryData.fromObject(model).toObject(OrganizationResourceListResult.class); + Assertions.assertEquals("qtrgqjbpfzfsinzg", model.value().get(0).location()); + Assertions.assertEquals("jrwzox", model.value().get(0).tags().get("j")); + Assertions.assertEquals("git", model.value().get(0).properties().marketplace().subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.UNSUBSCRIBED, + model.value().get(0).properties().marketplace().subscriptionStatus()); + Assertions.assertEquals("hab", model.value().get(0).properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("fpikxwczb", model.value().get(0).properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("scnpqxuhivy", model.value().get(0).properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("iwbybrkxvdumjg", + model.value().get(0).properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("fwvuk", model.value().get(0).properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("audccsnhs", model.value().get(0).properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("cnyejhkryhtnapcz", model.value().get(0).properties().user().firstName()); + Assertions.assertEquals("lokjyemkk", model.value().get(0).properties().user().lastName()); + Assertions.assertEquals("ni", model.value().get(0).properties().user().emailAddress()); + Assertions.assertEquals("oxzjnchgejspod", model.value().get(0).properties().user().upn()); + Assertions.assertEquals("ilzyd", model.value().get(0).properties().user().phoneNumber()); + Assertions.assertEquals("yahux", + model.value().get(0).properties().partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("pmqnja", + model.value().get(0).properties().partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("wixjsprozvcp", + model.value().get(0).properties().partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("eg", + model.value().get(0).properties().partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.ENABLE, model.value().get(0).properties() + .partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("datscmd", model.value().get(0).properties().partnerOrganizationProperties() + .singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("jhulsuuvmkjo", model.value().get(0).properties().partnerOrganizationProperties() + .singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("wfndiodjpsl", model.value().get(0).properties().partnerOrganizationProperties() + .singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); + Assertions.assertEquals("xgispemvtzfkufu", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceUpdatePropertiesTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceUpdatePropertiesTests.java new file mode 100644 index 0000000000000..5cdb1c3f7390a --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceUpdatePropertiesTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationPropertiesUpdate; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetailsUpdate; +import com.azure.resourcemanager.astro.models.OrganizationResourceUpdateProperties; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationResourceUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationResourceUpdateProperties model = BinaryData.fromString( + "{\"user\":{\"firstName\":\"pphrcgynco\",\"lastName\":\"ecfvmm\",\"emailAddress\":\"ofsx\",\"upn\":\"evgbmqjq\",\"phoneNumber\":\"c\"},\"partnerOrganizationProperties\":{\"organizationId\":\"ivkwlzuvccfwnfnb\",\"workspaceId\":\"fionl\",\"organizationName\":\"x\",\"workspaceName\":\"qgtz\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Disable\",\"enterpriseAppId\":\"bqqwxrj\",\"singleSignOnUrl\":\"al\",\"aadDomains\":[\"sub\",\"snjampmng\",\"zscxaqwo\"],\"provisioningState\":\"Succeeded\"}}}") + .toObject(OrganizationResourceUpdateProperties.class); + Assertions.assertEquals("pphrcgynco", model.user().firstName()); + Assertions.assertEquals("ecfvmm", model.user().lastName()); + Assertions.assertEquals("ofsx", model.user().emailAddress()); + Assertions.assertEquals("evgbmqjq", model.user().upn()); + Assertions.assertEquals("c", model.user().phoneNumber()); + Assertions.assertEquals("ivkwlzuvccfwnfnb", model.partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("fionl", model.partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("x", model.partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("qgtz", model.partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, + model.partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("bqqwxrj", + model.partnerOrganizationProperties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("al", model.partnerOrganizationProperties().singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("sub", + model.partnerOrganizationProperties().singleSignOnProperties().aadDomains().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationResourceUpdateProperties model + = new OrganizationResourceUpdateProperties() + .withUser(new LiftrBaseUserDetailsUpdate().withFirstName("pphrcgynco").withLastName("ecfvmm") + .withEmailAddress("ofsx").withUpn("evgbmqjq").withPhoneNumber("c")) + .withPartnerOrganizationProperties( + new LiftrBaseDataPartnerOrganizationPropertiesUpdate().withOrganizationId("ivkwlzuvccfwnfnb") + .withWorkspaceId("fionl").withOrganizationName("x").withWorkspaceName("qgtz") + .withSingleSignOnProperties(new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.DISABLE).withEnterpriseAppId("bqqwxrj") + .withSingleSignOnUrl("al").withAadDomains(Arrays.asList("sub", "snjampmng", "zscxaqwo")))); + model = BinaryData.fromObject(model).toObject(OrganizationResourceUpdateProperties.class); + Assertions.assertEquals("pphrcgynco", model.user().firstName()); + Assertions.assertEquals("ecfvmm", model.user().lastName()); + Assertions.assertEquals("ofsx", model.user().emailAddress()); + Assertions.assertEquals("evgbmqjq", model.user().upn()); + Assertions.assertEquals("c", model.user().phoneNumber()); + Assertions.assertEquals("ivkwlzuvccfwnfnb", model.partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("fionl", model.partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("x", model.partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("qgtz", model.partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, + model.partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("bqqwxrj", + model.partnerOrganizationProperties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("al", model.partnerOrganizationProperties().singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("sub", + model.partnerOrganizationProperties().singleSignOnProperties().aadDomains().get(0)); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceUpdateTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceUpdateTests.java new file mode 100644 index 0000000000000..acf0acea68b72 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationResourceUpdateTests.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationPropertiesUpdate; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetailsUpdate; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.OrganizationResourceUpdate; +import com.azure.resourcemanager.astro.models.OrganizationResourceUpdateProperties; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import com.azure.resourcemanager.astro.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationResourceUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationResourceUpdate model = BinaryData.fromString( + "{\"identity\":{\"principalId\":\"7171041d-1d80-4bb9-b5c0-5a4a400ee11e\",\"tenantId\":\"8fccb072-1b62-4a8c-887a-b5f97fbf7731\",\"type\":\"None\",\"userAssignedIdentities\":{\"ocjjxhvpmouexh\":{\"principalId\":\"73c14fcb-3b23-45b7-8f87-4f48f0427483\",\"clientId\":\"23afc0eb-e766-48c6-94cd-9cc9cd28205d\"},\"i\":{\"principalId\":\"3587ce5f-5b26-46ad-af7f-2d6aee29d0e1\",\"clientId\":\"aeaaf221-9fc4-4694-b325-16a3794dafb3\"},\"ojnxqbzvdd\":{\"principalId\":\"d0be851b-93e1-452d-a37e-48fe0355054f\",\"clientId\":\"004fc17c-8c9d-480f-bdb2-6e3d7c28a490\"}}},\"tags\":{\"btwnpzaoqvuhrhcf\":\"ndei\",\"pyeicxm\":\"cyddglmjthjqk\",\"ixuigdtopbobj\":\"ciwqvhk\"},\"properties\":{\"user\":{\"firstName\":\"e\",\"lastName\":\"a\",\"emailAddress\":\"uhrzayvvt\",\"upn\":\"vdfgiotk\",\"phoneNumber\":\"utqxlngx\"},\"partnerOrganizationProperties\":{\"organizationId\":\"gug\",\"workspaceId\":\"krxd\",\"organizationName\":\"i\",\"workspaceName\":\"thz\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Disable\",\"enterpriseAppId\":\"abhjybi\",\"singleSignOnUrl\":\"h\",\"aadDomains\":[\"bowsk\",\"nyktzlcuiy\",\"gqywgndrv\"],\"provisioningState\":\"Succeeded\"}}}}") + .toObject(OrganizationResourceUpdate.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + Assertions.assertEquals("ndei", model.tags().get("btwnpzaoqvuhrhcf")); + Assertions.assertEquals("e", model.properties().user().firstName()); + Assertions.assertEquals("a", model.properties().user().lastName()); + Assertions.assertEquals("uhrzayvvt", model.properties().user().emailAddress()); + Assertions.assertEquals("vdfgiotk", model.properties().user().upn()); + Assertions.assertEquals("utqxlngx", model.properties().user().phoneNumber()); + Assertions.assertEquals("gug", model.properties().partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("krxd", model.properties().partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("i", model.properties().partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("thz", model.properties().partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, + model.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("abhjybi", + model.properties().partnerOrganizationProperties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("h", + model.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("bowsk", + model.properties().partnerOrganizationProperties().singleSignOnProperties().aadDomains().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationResourceUpdate model = new OrganizationResourceUpdate() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("ocjjxhvpmouexh", new UserAssignedIdentity(), "i", + new UserAssignedIdentity(), "ojnxqbzvdd", new UserAssignedIdentity()))) + .withTags(mapOf("btwnpzaoqvuhrhcf", "ndei", "pyeicxm", "cyddglmjthjqk", "ixuigdtopbobj", "ciwqvhk")) + .withProperties(new OrganizationResourceUpdateProperties() + .withUser(new LiftrBaseUserDetailsUpdate().withFirstName("e").withLastName("a") + .withEmailAddress("uhrzayvvt").withUpn("vdfgiotk").withPhoneNumber("utqxlngx")) + .withPartnerOrganizationProperties(new LiftrBaseDataPartnerOrganizationPropertiesUpdate() + .withOrganizationId("gug").withWorkspaceId("krxd").withOrganizationName("i") + .withWorkspaceName("thz") + .withSingleSignOnProperties(new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.DISABLE).withEnterpriseAppId("abhjybi") + .withSingleSignOnUrl("h").withAadDomains(Arrays.asList("bowsk", "nyktzlcuiy", "gqywgndrv"))))); + model = BinaryData.fromObject(model).toObject(OrganizationResourceUpdate.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + Assertions.assertEquals("ndei", model.tags().get("btwnpzaoqvuhrhcf")); + Assertions.assertEquals("e", model.properties().user().firstName()); + Assertions.assertEquals("a", model.properties().user().lastName()); + Assertions.assertEquals("uhrzayvvt", model.properties().user().emailAddress()); + Assertions.assertEquals("vdfgiotk", model.properties().user().upn()); + Assertions.assertEquals("utqxlngx", model.properties().user().phoneNumber()); + Assertions.assertEquals("gug", model.properties().partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("krxd", model.properties().partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("i", model.properties().partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("thz", model.properties().partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, + model.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("abhjybi", + model.properties().partnerOrganizationProperties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("h", + model.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("bowsk", + model.properties().partnerOrganizationProperties().singleSignOnProperties().aadDomains().get(0)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsCreateOrUpdateMockTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..04539744c9f88 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsCreateOrUpdateMockTests.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.astro.AstroManager; +import com.azure.resourcemanager.astro.models.LiftrBaseDataOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseDataPartnerOrganizationProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseMarketplaceDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseOfferDetails; +import com.azure.resourcemanager.astro.models.LiftrBaseSingleSignOnProperties; +import com.azure.resourcemanager.astro.models.LiftrBaseUserDetails; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentity; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.astro.models.OrganizationResource; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import com.azure.resourcemanager.astro.models.UserAssignedIdentity; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OrganizationsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"marketplace\":{\"subscriptionId\":\"yudxytlmoy\",\"subscriptionStatus\":\"Unsubscribed\",\"offerDetails\":{\"publisherId\":\"wfudwpzntxhdzhl\",\"offerId\":\"qj\",\"planId\":\"hckfrlhrx\",\"planName\":\"kyv\",\"termUnit\":\"ca\",\"termId\":\"z\"}},\"user\":{\"firstName\":\"p\",\"lastName\":\"kafkuwbcrnwbm\",\"emailAddress\":\"hhseyv\",\"upn\":\"srtslhspkdeem\",\"phoneNumber\":\"fm\"},\"provisioningState\":\"Succeeded\",\"partnerOrganizationProperties\":{\"organizationId\":\"t\",\"workspaceId\":\"lmqkrhahvlj\",\"organizationName\":\"ahaquh\",\"workspaceName\":\"hmdua\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Initial\",\"enterpriseAppId\":\"pvfadmwsrcr\",\"singleSignOnUrl\":\"xpvgo\",\"aadDomains\":[\"fmisg\"],\"provisioningState\":\"Canceled\"}}},\"identity\":{\"principalId\":\"7b173769-6f47-4f90-bd6b-174679e68faf\",\"tenantId\":\"69f055d0-3943-46e7-b013-3ba073df585b\",\"type\":\"SystemAssigned, UserAssigned\",\"userAssignedIdentities\":{\"zbaliourqha\":{\"principalId\":\"811d9437-a9e5-4d8f-8c9b-ea3e4948818b\",\"clientId\":\"d3c5045e-70bd-47f0-a9d7-9038d4e01fc8\"}}},\"location\":\"uhashsfwx\",\"tags\":{\"xcug\":\"w\",\"ovbvmeueciv\":\"cjooxdjebwpucwwf\"},\"id\":\"hzceuojgjrwjue\",\"name\":\"otwmcdyt\",\"type\":\"x\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AstroManager manager = AstroManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + OrganizationResource response = manager.organizations().define("wz").withRegion("njbkcnxdhbttkph") + .withExistingResourceGroup("bniwdj") + .withTags(mapOf("t", "nv", "crpab", "qnermclfplphoxu", "sbj", "ye", "wfqkquj", "azqugxywpmueefj")) + .withProperties(new LiftrBaseDataOrganizationProperties() + .withMarketplace(new LiftrBaseMarketplaceDetails().withSubscriptionId("dbpgnxytxhp") + .withSubscriptionStatus(MarketplaceSubscriptionStatus.SUBSCRIBED) + .withOfferDetails(new LiftrBaseOfferDetails().withPublisherId("zpfzabglc").withOfferId("hxw") + .withPlanId("ctyqik").withPlanName("bovpl").withTermUnit("bhvgy").withTermId("uosvmkfssxqukk"))) + .withUser(new LiftrBaseUserDetails().withFirstName("plgmgsxnk").withLastName("zkd") + .withEmailAddress("slpvlop").withUpn("yighxpk").withPhoneNumber("zb")) + .withPartnerOrganizationProperties(new LiftrBaseDataPartnerOrganizationProperties() + .withOrganizationId("baumnyqupedeoj").withWorkspaceId("bckhsmtxpsi") + .withOrganizationName("btfhvpesaps").withWorkspaceName("dqmh") + .withSingleSignOnProperties(new LiftrBaseSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.DISABLE).withEnterpriseAppId("ldwkyzxuutkn") + .withSingleSignOnUrl("scwsv").withAadDomains(Arrays.asList("togt", "rupqsxvnmicy", "vce"))))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("fj", new UserAssignedIdentity()))) + .create(); + + Assertions.assertEquals("uhashsfwx", response.location()); + Assertions.assertEquals("w", response.tags().get("xcug")); + Assertions.assertEquals("yudxytlmoy", response.properties().marketplace().subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.UNSUBSCRIBED, + response.properties().marketplace().subscriptionStatus()); + Assertions.assertEquals("wfudwpzntxhdzhl", response.properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("qj", response.properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("hckfrlhrx", response.properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("kyv", response.properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("ca", response.properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("z", response.properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("p", response.properties().user().firstName()); + Assertions.assertEquals("kafkuwbcrnwbm", response.properties().user().lastName()); + Assertions.assertEquals("hhseyv", response.properties().user().emailAddress()); + Assertions.assertEquals("srtslhspkdeem", response.properties().user().upn()); + Assertions.assertEquals("fm", response.properties().user().phoneNumber()); + Assertions.assertEquals("t", response.properties().partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("lmqkrhahvlj", response.properties().partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("ahaquh", response.properties().partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("hmdua", response.properties().partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.INITIAL, + response.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("pvfadmwsrcr", + response.properties().partnerOrganizationProperties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("xpvgo", + response.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("fmisg", + response.properties().partnerOrganizationProperties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, response.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsGetByResourceGroupWithResponseMockTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 0000000000000..7566010aa383c --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.astro.AstroManager; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.astro.models.OrganizationResource; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OrganizationsGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"marketplace\":{\"subscriptionId\":\"brjcxe\",\"subscriptionStatus\":\"Unsubscribed\",\"offerDetails\":{\"publisherId\":\"wutttxfvjrbi\",\"offerId\":\"phxepcyvahf\",\"planId\":\"ljkyqxjvuuj\",\"planName\":\"idokgjlj\",\"termUnit\":\"xgvcl\",\"termId\":\"gsncghkjeszz\"}},\"user\":{\"firstName\":\"bijhtxfvgxbf\",\"lastName\":\"mxnehmp\",\"emailAddress\":\"ec\",\"upn\":\"odebfqkkrbmpu\",\"phoneNumber\":\"riwflzlfb\"},\"provisioningState\":\"Succeeded\",\"partnerOrganizationProperties\":{\"organizationId\":\"ycispnqzahmgkb\",\"workspaceId\":\"yydhibnuqqk\",\"organizationName\":\"ik\",\"workspaceName\":\"rgvtqag\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Disable\",\"enterpriseAppId\":\"hijggme\",\"singleSignOnUrl\":\"siarbutrcvpn\",\"aadDomains\":[\"mhjrunmpxttdbhr\",\"nlankxmyskpb\",\"enbtkcxywny\"],\"provisioningState\":\"Failed\"}}},\"identity\":{\"principalId\":\"4e9d45d5-9993-4d5e-956e-afa53d820d11\",\"tenantId\":\"0bd69aea-19b9-464a-894d-f0c666a4f28c\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"by\":{\"principalId\":\"59e2d09a-be5b-4633-b0d0-8d448a9a2d68\",\"clientId\":\"9e6dc9ad-5317-4565-a2ba-2d9d95c40f9a\"},\"fclhaaxdbabphlwr\":{\"principalId\":\"1bbf30c6-ac2d-4140-bb61-9e8e1800d572\",\"clientId\":\"a0ecb2b4-9432-4c28-8ffc-f726050b1133\"},\"ktsthsucocmny\":{\"principalId\":\"8eeb914e-fa06-45f5-94bb-d9a976cfd92a\",\"clientId\":\"3d80fb79-7470-40fd-9c1e-cd36b3203fa2\"}}},\"location\":\"zt\",\"tags\":{\"uedck\":\"wwrq\",\"bxu\":\"ywbiexzfeyueax\"},\"id\":\"wbhqwal\",\"name\":\"uzyoxaep\",\"type\":\"kzjancuxrhdwbav\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AstroManager manager = AstroManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + OrganizationResource response = manager.organizations() + .getByResourceGroupWithResponse("ctq", "jf", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("zt", response.location()); + Assertions.assertEquals("wwrq", response.tags().get("uedck")); + Assertions.assertEquals("brjcxe", response.properties().marketplace().subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.UNSUBSCRIBED, + response.properties().marketplace().subscriptionStatus()); + Assertions.assertEquals("wutttxfvjrbi", response.properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("phxepcyvahf", response.properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("ljkyqxjvuuj", response.properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("idokgjlj", response.properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("xgvcl", response.properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("gsncghkjeszz", response.properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("bijhtxfvgxbf", response.properties().user().firstName()); + Assertions.assertEquals("mxnehmp", response.properties().user().lastName()); + Assertions.assertEquals("ec", response.properties().user().emailAddress()); + Assertions.assertEquals("odebfqkkrbmpu", response.properties().user().upn()); + Assertions.assertEquals("riwflzlfb", response.properties().user().phoneNumber()); + Assertions.assertEquals("ycispnqzahmgkb", + response.properties().partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("yydhibnuqqk", response.properties().partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("ik", response.properties().partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("rgvtqag", response.properties().partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, + response.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("hijggme", + response.properties().partnerOrganizationProperties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("siarbutrcvpn", + response.properties().partnerOrganizationProperties().singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("mhjrunmpxttdbhr", + response.properties().partnerOrganizationProperties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsListByResourceGroupMockTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsListByResourceGroupMockTests.java new file mode 100644 index 0000000000000..6e5037753b496 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsListByResourceGroupMockTests.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.astro.AstroManager; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.astro.models.OrganizationResource; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OrganizationsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"properties\":{\"marketplace\":{\"subscriptionId\":\"leggzfbu\",\"subscriptionStatus\":\"Unsubscribed\",\"offerDetails\":{\"publisherId\":\"vfaxkffeiith\",\"offerId\":\"vmezy\",\"planId\":\"shxmzsbbzoggigrx\",\"planName\":\"ur\",\"termUnit\":\"xxjnspydptk\",\"termId\":\"nkoukn\"}},\"user\":{\"firstName\":\"udwtiukbl\",\"lastName\":\"ngkpocipazy\",\"emailAddress\":\"o\",\"upn\":\"ukgjnpiucgygevq\",\"phoneNumber\":\"typmrbpizcdrqjsd\"},\"provisioningState\":\"Succeeded\",\"partnerOrganizationProperties\":{\"organizationId\":\"yhxdeoejzicwi\",\"workspaceId\":\"jttgzf\",\"organizationName\":\"ishc\",\"workspaceName\":\"hajdeyeamdpha\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Enable\",\"enterpriseAppId\":\"uxwgipwho\",\"singleSignOnUrl\":\"wkgshwa\",\"aadDomains\":[\"xzbinjeputt\",\"rywn\",\"zoqftiyqzrnkcqvy\",\"lwh\"],\"provisioningState\":\"Failed\"}}},\"identity\":{\"principalId\":\"91d6c3b6-fc72-4c81-ab77-d9248cc8c483\",\"tenantId\":\"8fe438a3-0658-44f5-9c82-7cdb2daad567\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"wvl\":{\"principalId\":\"e83f22ab-be36-48b9-94a3-d64016f455e2\",\"clientId\":\"f48b4c2f-9a0d-4e8b-9d1d-e309ae839006\"}}},\"location\":\"avwhheunm\",\"tags\":{\"noc\":\"gyxzk\",\"uconuqszfkbey\":\"koklya\",\"senhwlrs\":\"ewrmjmwvvjektc\"},\"id\":\"frzpwvlqdqgb\",\"name\":\"qylihkaetckt\",\"type\":\"fcivfsnkym\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AstroManager manager = AstroManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.organizations().listByResourceGroup("pclhocohslk", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("avwhheunm", response.iterator().next().location()); + Assertions.assertEquals("gyxzk", response.iterator().next().tags().get("noc")); + Assertions.assertEquals("leggzfbu", response.iterator().next().properties().marketplace().subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.UNSUBSCRIBED, + response.iterator().next().properties().marketplace().subscriptionStatus()); + Assertions.assertEquals("vfaxkffeiith", + response.iterator().next().properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("vmezy", + response.iterator().next().properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("shxmzsbbzoggigrx", + response.iterator().next().properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("ur", response.iterator().next().properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("xxjnspydptk", + response.iterator().next().properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("nkoukn", + response.iterator().next().properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("udwtiukbl", response.iterator().next().properties().user().firstName()); + Assertions.assertEquals("ngkpocipazy", response.iterator().next().properties().user().lastName()); + Assertions.assertEquals("o", response.iterator().next().properties().user().emailAddress()); + Assertions.assertEquals("ukgjnpiucgygevq", response.iterator().next().properties().user().upn()); + Assertions.assertEquals("typmrbpizcdrqjsd", response.iterator().next().properties().user().phoneNumber()); + Assertions.assertEquals("yhxdeoejzicwi", + response.iterator().next().properties().partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("jttgzf", + response.iterator().next().properties().partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("ishc", + response.iterator().next().properties().partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("hajdeyeamdpha", + response.iterator().next().properties().partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.ENABLE, response.iterator().next().properties() + .partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("uxwgipwho", response.iterator().next().properties().partnerOrganizationProperties() + .singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("wkgshwa", response.iterator().next().properties().partnerOrganizationProperties() + .singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("xzbinjeputt", response.iterator().next().properties().partnerOrganizationProperties() + .singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsListMockTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsListMockTests.java new file mode 100644 index 0000000000000..47134db3d9730 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/OrganizationsListMockTests.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.astro.AstroManager; +import com.azure.resourcemanager.astro.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.astro.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.astro.models.OrganizationResource; +import com.azure.resourcemanager.astro.models.SingleSignOnStates; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OrganizationsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"properties\":{\"marketplace\":{\"subscriptionId\":\"cibvyvdcsitynn\",\"subscriptionStatus\":\"Unsubscribed\",\"offerDetails\":{\"publisherId\":\"dectehfiqsc\",\"offerId\":\"eypvhezrkg\",\"planId\":\"hcjrefovgmk\",\"planName\":\"leyyvx\",\"termUnit\":\"jpkcattpng\",\"termId\":\"rcczsqpjhvmd\"}},\"user\":{\"firstName\":\"jvnysounqe\",\"lastName\":\"a\",\"emailAddress\":\"oaeupfhyhltrpmo\",\"upn\":\"mcmatuokthfuiu\",\"phoneNumber\":\"dsfcpkvxodpuoz\"},\"provisioningState\":\"Failed\",\"partnerOrganizationProperties\":{\"organizationId\":\"agfuaxbezyiu\",\"workspaceId\":\"ktwh\",\"organizationName\":\"dxwzywqsmbsurexi\",\"workspaceName\":\"ryocfsfksymdd\",\"singleSignOnProperties\":{\"singleSignOnState\":\"Disable\",\"enterpriseAppId\":\"iuxhqyudxorr\",\"singleSignOnUrl\":\"b\",\"aadDomains\":[\"zvyifqrvkdvj\",\"llr\"],\"provisioningState\":\"Canceled\"}}},\"identity\":{\"principalId\":\"df62dde2-7fd5-4220-9ad9-3e31becb278e\",\"tenantId\":\"2033f9e8-4945-4ea4-acec-aa16be17e8d6\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"pulexxbczw\":{\"principalId\":\"3af2e207-5f30-47fc-84f8-4e62e83f5855\",\"clientId\":\"9613cc8a-b06f-4b62-9a84-cc3b4af72bda\"},\"wiqzbqjvsovmyo\":{\"principalId\":\"a32499ba-1e48-443d-9dbc-81d7f2ce2e6f\",\"clientId\":\"aa7e207d-a3ed-4290-9ecc-a2a4bc4341a4\"},\"spkwlhzdobpxjm\":{\"principalId\":\"157df892-7a9f-4a55-9a57-b6393db7c013\",\"clientId\":\"407a9cce-2283-4ff7-a4d4-c09c9f875c4e\"},\"vvnchrkcc\":{\"principalId\":\"631179ce-e327-4d99-b258-0919aa4ce089\",\"clientId\":\"36a6c1e6-2798-4ebf-a07c-bb5143f66ed8\"}}},\"location\":\"wzjuqk\",\"tags\":{\"oskg\":\"ajiwkuo\"},\"id\":\"sauuimj\",\"name\":\"vxieduugidyj\",\"type\":\"rfbyaosvexcso\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AstroManager manager = AstroManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.organizations().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("wzjuqk", response.iterator().next().location()); + Assertions.assertEquals("ajiwkuo", response.iterator().next().tags().get("oskg")); + Assertions.assertEquals("cibvyvdcsitynn", + response.iterator().next().properties().marketplace().subscriptionId()); + Assertions.assertEquals(MarketplaceSubscriptionStatus.UNSUBSCRIBED, + response.iterator().next().properties().marketplace().subscriptionStatus()); + Assertions.assertEquals("dectehfiqsc", + response.iterator().next().properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("eypvhezrkg", + response.iterator().next().properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("hcjrefovgmk", + response.iterator().next().properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("leyyvx", + response.iterator().next().properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("jpkcattpng", + response.iterator().next().properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("rcczsqpjhvmd", + response.iterator().next().properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("jvnysounqe", response.iterator().next().properties().user().firstName()); + Assertions.assertEquals("a", response.iterator().next().properties().user().lastName()); + Assertions.assertEquals("oaeupfhyhltrpmo", response.iterator().next().properties().user().emailAddress()); + Assertions.assertEquals("mcmatuokthfuiu", response.iterator().next().properties().user().upn()); + Assertions.assertEquals("dsfcpkvxodpuoz", response.iterator().next().properties().user().phoneNumber()); + Assertions.assertEquals("agfuaxbezyiu", + response.iterator().next().properties().partnerOrganizationProperties().organizationId()); + Assertions.assertEquals("ktwh", + response.iterator().next().properties().partnerOrganizationProperties().workspaceId()); + Assertions.assertEquals("dxwzywqsmbsurexi", + response.iterator().next().properties().partnerOrganizationProperties().organizationName()); + Assertions.assertEquals("ryocfsfksymdd", + response.iterator().next().properties().partnerOrganizationProperties().workspaceName()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, response.iterator().next().properties() + .partnerOrganizationProperties().singleSignOnProperties().singleSignOnState()); + Assertions.assertEquals("iuxhqyudxorr", response.iterator().next().properties().partnerOrganizationProperties() + .singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("b", response.iterator().next().properties().partnerOrganizationProperties() + .singleSignOnProperties().singleSignOnUrl()); + Assertions.assertEquals("zvyifqrvkdvj", response.iterator().next().properties().partnerOrganizationProperties() + .singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, + response.iterator().next().identity().type()); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/UserAssignedIdentityTests.java b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/UserAssignedIdentityTests.java new file mode 100644 index 0000000000000..50b56108087a0 --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/java/com/azure/resourcemanager/astro/generated/UserAssignedIdentityTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.astro.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.astro.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model = BinaryData.fromString( + "{\"principalId\":\"d4c59a80-b5f8-4017-b9e8-0604545774bf\",\"clientId\":\"efcb5a0a-3225-4212-b512-f67c717a1975\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/astro/azure-resourcemanager-astro/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/astro/azure-resourcemanager-astro/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 0000000000000..1f0955d450f0d --- /dev/null +++ b/sdk/astro/azure-resourcemanager-astro/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline diff --git a/sdk/astro/ci.yml b/sdk/astro/ci.yml new file mode 100644 index 0000000000000..40d231131c8d8 --- /dev/null +++ b/sdk/astro/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/astro/ci.yml + - sdk/astro/azure-resourcemanager-astro/ + exclude: + - sdk/astro/pom.xml + - sdk/astro/azure-resourcemanager-astro/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/astro/ci.yml + - sdk/astro/azure-resourcemanager-astro/ + exclude: + - sdk/astro/pom.xml + - sdk/astro/azure-resourcemanager-astro/pom.xml + +parameters: + - name: release_azureresourcemanagerastro + displayName: azure-resourcemanager-astro + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: astro + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-astro + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerastro + releaseInBatch: ${{ parameters.release_azureresourcemanagerastro }} diff --git a/sdk/astro/pom.xml b/sdk/astro/pom.xml new file mode 100644 index 0000000000000..4025ab8be189c --- /dev/null +++ b/sdk/astro/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-astro-service + pom + 1.0.0 + + + azure-resourcemanager-astro + +