diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 8d23ad432957..995e91256609 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -411,6 +411,7 @@ com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;1.0.0-beta com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-qumulo;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-selfhelp;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-saas;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-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 216e9f2ee091..ce6f873b0fe4 100644 --- a/pom.xml +++ b/pom.xml @@ -153,6 +153,7 @@ sdk/resourcehealth sdk/resourcemanager sdk/resourcemover + sdk/saas sdk/schemaregistry sdk/scvmm sdk/search diff --git a/sdk/saas/azure-resourcemanager-saas/CHANGELOG.md b/sdk/saas/azure-resourcemanager-saas/CHANGELOG.md new file mode 100644 index 000000000000..f1b8df2dc5d0 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-05-12) + +- Azure Resource Manager SaaS client library for Java. This package contains Microsoft Azure SDK for SaaS Management SDK. REST APIs for Azure Marketplace SaaS Offers. Package tag package-2018-03-01-beta. 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/saas/azure-resourcemanager-saas/README.md b/sdk/saas/azure-resourcemanager-saas/README.md new file mode 100644 index 000000000000..5d18b4945199 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager SaaS client library for Java + +Azure Resource Manager SaaS client library for Java. + +This package contains Microsoft Azure SDK for SaaS Management SDK. REST APIs for Azure Marketplace SaaS Offers. Package tag package-2018-03-01-beta. 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-saas;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-saas + 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, Azure Active Directory 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(); +SaaSManager manager = SaaSManager + .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/saas/azure-resourcemanager-saas/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://docs.microsoft.com/java/azure/jdk/ +[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/ diff --git a/sdk/saas/azure-resourcemanager-saas/SAMPLE.md b/sdk/saas/azure-resourcemanager-saas/SAMPLE.md new file mode 100644 index 000000000000..d12848de2fe9 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/SAMPLE.md @@ -0,0 +1,574 @@ +# Code snippets and samples + + +## Applications + +- [ListByResourceGroup](#applications_listbyresourcegroup) + +## Operations + +- [List](#operations_list) + +## ResourceProvider + +- [SaasResourceListAccessToken](#resourceprovider_saasresourcelistaccesstoken) + +## SaaS + +- [CreateResource](#saas_createresource) +- [Delete](#saas_delete) +- [GetResource](#saas_getresource) +- [UpdateResource](#saas_updateresource) + +## SaaSOperation + +- [Get](#saasoperation_get) + +## SaasResources + +- [List](#saasresources_list) + +## SaasSubscriptionLevel + +- [CreateOrUpdate](#saassubscriptionlevel_createorupdate) +- [Delete](#saassubscriptionlevel_delete) +- [GetByResourceGroup](#saassubscriptionlevel_getbyresourcegroup) +- [List](#saassubscriptionlevel_list) +- [ListAccessToken](#saassubscriptionlevel_listaccesstoken) +- [ListByResourceGroup](#saassubscriptionlevel_listbyresourcegroup) +- [MoveResources](#saassubscriptionlevel_moveresources) +- [Update](#saassubscriptionlevel_update) +- [UpdateToUnsubscribed](#saassubscriptionlevel_updatetounsubscribed) +- [ValidateMoveResources](#saassubscriptionlevel_validatemoveresources) +### Applications_ListByResourceGroup + +```java +/** Samples for Applications ListByResourceGroup. */ +public final class ApplicationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV1/SaaSGetApplications.json + */ + /** + * Sample code: Get saas application. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSaasApplication(com.azure.resourcemanager.saas.SaaSManager manager) { + manager.applications().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV1/SaaSGetOperations.json + */ + /** + * Sample code: Get saas operations. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSaasOperations(com.azure.resourcemanager.saas.SaaSManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_SaasResourceListAccessToken + +```java +/** Samples for ResourceProvider SaasResourceListAccessToken. */ +public final class ResourceProviderSaasResourceListAccessTokenSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/ListAccessTokenPost.json + */ + /** + * Sample code: generated SaaS resource token. + * + * @param manager Entry point to SaaSManager. + */ + public static void generatedSaaSResourceToken(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .resourceProviders() + .saasResourceListAccessTokenWithResponse( + "c825645b-e31b-9cf4-1cee-2aba9e58bc7c", com.azure.core.util.Context.NONE); + } +} +``` + +### SaaS_CreateResource + +```java +import com.azure.resourcemanager.saas.models.PaymentChannelType; +import com.azure.resourcemanager.saas.models.SaasCreationProperties; +import com.azure.resourcemanager.saas.models.SaasResourceCreation; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SaaS CreateResource. */ +public final class SaaSCreateResourceSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/SaasPut.json + */ + /** + * Sample code: Create SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void createSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saaS() + .createResource( + new SaasResourceCreation() + .withProperties( + new SaasCreationProperties() + .withOfferId("microsofthealthcarebot") + .withPublisherId("microsoft-hcb") + .withSkuId("free") + .withPaymentChannelType(PaymentChannelType.SUBSCRIPTION_DELEGATED) + .withPaymentChannelMetadata( + mapOf("AzureSubscriptionId", "155af98a-3205-47e7-883b-a2ab9db9f88d")) + .withSaasResourceName("testRunnerFromArm") + .withTermId("hjdtn7tfnxcy")), + com.azure.core.util.Context.NONE); + } + + @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; + } +} +``` + +### SaaS_Delete + +```java +import com.azure.resourcemanager.saas.models.DeleteOptions; + +/** Samples for SaaS Delete. */ +public final class SaaSDeleteSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/SaasDelete.json + */ + /** + * Sample code: Delete SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void deleteSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saaS() + .delete( + "115c3523-1fae-757f-af86-7b27cfd29805", + new DeleteOptions().withUnsubscribeOnly(true).withReasonCode(0.0F), + com.azure.core.util.Context.NONE); + } +} +``` + +### SaaS_GetResource + +```java +/** Samples for SaaS GetResource. */ +public final class SaaSGetResourceSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/SaasGet.json + */ + /** + * Sample code: Get SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saaS() + .getResourceWithResponse("115c3523-1fae-757f-af86-7b27cfd29805", com.azure.core.util.Context.NONE); + } +} +``` + +### SaaS_UpdateResource + +```java +import com.azure.resourcemanager.saas.models.SaasCreationProperties; +import com.azure.resourcemanager.saas.models.SaasResourceCreation; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SaaS UpdateResource. */ +public final class SaaSUpdateResourceSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/SaasPatch.json + */ + /** + * Sample code: Update SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void updateSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saaS() + .updateResource( + "115c3523-1fae-757f-af86-7b27cfd29805", + new SaasResourceCreation() + .withTags(mapOf()) + .withProperties(new SaasCreationProperties().withSkuId("premium")), + com.azure.core.util.Context.NONE); + } + + @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; + } +} +``` + +### SaaSOperation_Get + +```java +/** Samples for SaaSOperation Get. */ +public final class SaaSOperationGetSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/OperationResults/Get.json + */ + /** + * Sample code: Get operation status. + * + * @param manager Entry point to SaaSManager. + */ + public static void getOperationStatus(com.azure.resourcemanager.saas.SaaSManager manager) { + manager.saaSOperations().get("5f35cb4c-8065-45b3-9116-5ba335462e95", com.azure.core.util.Context.NONE); + } +} +``` + +### SaasResources_List + +```java +/** Samples for SaasResources List. */ +public final class SaasResourcesListSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/SaaSGetAllResources.json + */ + /** + * Sample code: Get all SaaS resources. + * + * @param manager Entry point to SaaSManager. + */ + public static void getAllSaaSResources(com.azure.resourcemanager.saas.SaaSManager manager) { + manager.saasResources().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_CreateOrUpdate + +```java +import com.azure.resourcemanager.saas.models.PaymentChannelType; +import com.azure.resourcemanager.saas.models.SaasCreationProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SaasSubscriptionLevel CreateOrUpdate. */ +public final class SaasSubscriptionLevelCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasPut.json + */ + /** + * Sample code: Create subscription level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void createSubscriptionLevelSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .define("MyContosoSubscription") + .withExistingResourceGroup("my-saas-rg") + .withRegion("global") + .withName("MyContosoSubscription") + .withProperties( + new SaasCreationProperties() + .withOfferId("contosoOffer") + .withPublisherId("microsoft-contoso") + .withSkuId("free") + .withPaymentChannelType(PaymentChannelType.SUBSCRIPTION_DELEGATED) + .withPaymentChannelMetadata(mapOf("AzureSubscriptionId", "155af98a-3205-47e7-883b-a2ab9db9f88d")) + .withSaasResourceName("MyContosoSubscription") + .withTermId("hjdtn7tfnxcy")) + .create(); + } + + @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; + } +} +``` + +### SaasSubscriptionLevel_Delete + +```java +/** Samples for SaasSubscriptionLevel Delete. */ +public final class SaasSubscriptionLevelDeleteSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasDelete.json + */ + /** + * Sample code: Delete Subscription Level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void deleteSubscriptionLevelSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .delete("my-saas-rg", "MyContosoSubscription", com.azure.core.util.Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_GetByResourceGroup + +```java +/** Samples for SaasSubscriptionLevel GetByResourceGroup. */ +public final class SaasSubscriptionLevelGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasGet.json + */ + /** + * Sample code: Get subscription level saas resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSubscriptionLevelSaasResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .getByResourceGroupWithResponse("my-saas-rg", "MyContosoSubscription", com.azure.core.util.Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_List + +```java +/** Samples for SaasSubscriptionLevel List. */ +public final class SaasSubscriptionLevelListSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasGetAllInAzureSubscription.json + */ + /** + * Sample code: Get subscription level saas resources in Azure subscription. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSubscriptionLevelSaasResourcesInAzureSubscription( + com.azure.resourcemanager.saas.SaaSManager manager) { + manager.saasSubscriptionLevels().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_ListAccessToken + +```java +/** Samples for SaasSubscriptionLevel ListAccessToken. */ +public final class SaasSubscriptionLevelListAccessTokenSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/ListAccessTokenPost.json + */ + /** + * Sample code: List subscription level SaaS resource access token. + * + * @param manager Entry point to SaaSManager. + */ + public static void listSubscriptionLevelSaaSResourceAccessToken( + com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .listAccessTokenWithResponse("my-saas-rg", "MyContosoSubscription", com.azure.core.util.Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_ListByResourceGroup + +```java +/** Samples for SaasSubscriptionLevel ListByResourceGroup. */ +public final class SaasSubscriptionLevelListByResourceGroupSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasGetAllInResourceGroup.json + */ + /** + * Sample code: Get subscription level saas resources in resource group. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSubscriptionLevelSaasResourcesInResourceGroup( + com.azure.resourcemanager.saas.SaaSManager manager) { + manager.saasSubscriptionLevels().listByResourceGroup("my-saas-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_MoveResources + +```java +import com.azure.resourcemanager.saas.models.MoveResource; +import java.util.Arrays; + +/** Samples for SaasSubscriptionLevel MoveResources. */ +public final class SaasSubscriptionLevelMoveResourcesSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/ResourceMove.json + */ + /** + * Sample code: Move of a subscription Level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void moveOfASubscriptionLevelSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .moveResources( + "my-saas-rg", + new MoveResource() + .withTargetResourceGroup( + "/subscriptions/5122d0a3-1e10-4baf-bdc5-c2a452489525/resourceGroups/new-saas-rg") + .withResources( + Arrays + .asList( + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas1", + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas2", + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas3")), + com.azure.core.util.Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_Update + +```java +import com.azure.resourcemanager.saas.models.SaasCreationProperties; +import com.azure.resourcemanager.saas.models.SaasResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SaasSubscriptionLevel Update. */ +public final class SaasSubscriptionLevelUpdateSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasPatch.json + */ + /** + * Sample code: Update subscription level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void updateSubscriptionLevelSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + SaasResource resource = + manager + .saasSubscriptionLevels() + .getByResourceGroupWithResponse("my-saas-rg", "MyContosoSubscription", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).withProperties(new SaasCreationProperties().withSkuId("premium")).apply(); + } + + @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; + } +} +``` + +### SaasSubscriptionLevel_UpdateToUnsubscribed + +```java +import com.azure.resourcemanager.saas.models.DeleteOptions; + +/** Samples for SaasSubscriptionLevel UpdateToUnsubscribed. */ +public final class SaasSubscriptionLevelUpdateToUnsubscribedSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasUnsubscribe.json + */ + /** + * Sample code: Unsubscribe Subscription Level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void unsubscribeSubscriptionLevelSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .updateToUnsubscribed( + "my-saas-rg", + "MyContosoSubscription", + new DeleteOptions() + .withUnsubscribeOnly(true) + .withReasonCode(0.0F) + .withFeedback("No longer need this SaaS"), + com.azure.core.util.Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_ValidateMoveResources + +```java +import com.azure.resourcemanager.saas.models.MoveResource; +import java.util.Arrays; + +/** Samples for SaasSubscriptionLevel ValidateMoveResources. */ +public final class SaasSubscriptionLevelValidateMoveResourcesSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/ValidateResourceMove.json + */ + /** + * Sample code: Validate move of a subscription Level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void validateMoveOfASubscriptionLevelSaaSResource( + com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .validateMoveResourcesWithResponse( + "my-saas-rg", + new MoveResource() + .withTargetResourceGroup( + "/subscriptions/5122d0a3-1e10-4baf-bdc5-c2a452489525/resourceGroups/new-saas-rg") + .withResources( + Arrays + .asList( + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas1", + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas2", + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas3")), + com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/saas/azure-resourcemanager-saas/pom.xml b/sdk/saas/azure-resourcemanager-saas/pom.xml new file mode 100644 index 000000000000..0c886e904d12 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-saas + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for SaaS Management + This package contains Microsoft Azure SDK for SaaS Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST APIs for Azure Marketplace SaaS Offers. Package tag package-2018-03-01-beta. + 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 + + + + com.azure + azure-core + 1.39.0 + + + com.azure + azure-core-management + 1.11.1 + + + diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/SaaSManager.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/SaaSManager.java new file mode 100644 index 000000000000..79c472a09231 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/SaaSManager.java @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas; + +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.saas.fluent.SaaSManagementClient; +import com.azure.resourcemanager.saas.implementation.ApplicationsImpl; +import com.azure.resourcemanager.saas.implementation.OperationsImpl; +import com.azure.resourcemanager.saas.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.saas.implementation.SaaSImpl; +import com.azure.resourcemanager.saas.implementation.SaaSManagementClientBuilder; +import com.azure.resourcemanager.saas.implementation.SaaSOperationsImpl; +import com.azure.resourcemanager.saas.implementation.SaasResourcesImpl; +import com.azure.resourcemanager.saas.implementation.SaasSubscriptionLevelsImpl; +import com.azure.resourcemanager.saas.models.Applications; +import com.azure.resourcemanager.saas.models.Operations; +import com.azure.resourcemanager.saas.models.ResourceProviders; +import com.azure.resourcemanager.saas.models.SaaS; +import com.azure.resourcemanager.saas.models.SaaSOperations; +import com.azure.resourcemanager.saas.models.SaasResources; +import com.azure.resourcemanager.saas.models.SaasSubscriptionLevels; +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 SaaSManager. REST APIs for Azure Marketplace SaaS Offers. */ +public final class SaaSManager { + private Operations operations; + + private Applications applications; + + private SaaS saaS; + + private SaasResources saasResources; + + private ResourceProviders resourceProviders; + + private SaasSubscriptionLevels saasSubscriptionLevels; + + private SaaSOperations saaSOperations; + + private final SaaSManagementClient clientObject; + + private SaaSManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new SaaSManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of SaaS service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the SaaS service API instance. + */ + public static SaaSManager 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 SaaS service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the SaaS service API instance. + */ + public static SaaSManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new SaaSManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create SaaSManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new SaaSManager.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 SaaS service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the SaaS service API instance. + */ + public SaaSManager 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.saas") + .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 SaaSManager(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 Applications. + * + * @return Resource collection API of Applications. + */ + public Applications applications() { + if (this.applications == null) { + this.applications = new ApplicationsImpl(clientObject.getApplications(), this); + } + return applications; + } + + /** + * Gets the resource collection API of SaaS. + * + * @return Resource collection API of SaaS. + */ + public SaaS saaS() { + if (this.saaS == null) { + this.saaS = new SaaSImpl(clientObject.getSaaS(), this); + } + return saaS; + } + + /** + * Gets the resource collection API of SaasResources. + * + * @return Resource collection API of SaasResources. + */ + public SaasResources saasResources() { + if (this.saasResources == null) { + this.saasResources = new SaasResourcesImpl(clientObject.getSaasResources(), this); + } + return saasResources; + } + + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** + * Gets the resource collection API of SaasSubscriptionLevels. It manages SaasResource. + * + * @return Resource collection API of SaasSubscriptionLevels. + */ + public SaasSubscriptionLevels saasSubscriptionLevels() { + if (this.saasSubscriptionLevels == null) { + this.saasSubscriptionLevels = + new SaasSubscriptionLevelsImpl(clientObject.getSaasSubscriptionLevels(), this); + } + return saasSubscriptionLevels; + } + + /** + * Gets the resource collection API of SaaSOperations. + * + * @return Resource collection API of SaaSOperations. + */ + public SaaSOperations saaSOperations() { + if (this.saaSOperations == null) { + this.saaSOperations = new SaaSOperationsImpl(clientObject.getSaaSOperations(), this); + } + return saaSOperations; + } + + /** + * @return Wrapped service client SaaSManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public SaaSManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/ApplicationsClient.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/ApplicationsClient.java new file mode 100644 index 000000000000..1a3657fb6274 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/ApplicationsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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.saas.fluent.models.SaasAppInner; + +/** An instance of this class provides access to all the operations defined in ApplicationsClient. */ +public interface ApplicationsClient { + /** + * Gets all SaaS resources by subscription id and resource group name. + * + * @param resourceGroupName The name of the resource group. + * @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 all SaaS resources by subscription id and resource group name as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all SaaS resources by subscription id and resource group name. + * + * @param resourceGroupName The name of the resource group. + * @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 all SaaS resources by subscription id and resource group name as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/OperationsClient.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/OperationsClient.java new file mode 100644 index 000000000000..53a37318c2bd --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/OperationsClient.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.saas.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.saas.fluent.models.SaasAppOperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Gets all SaaS app operations. + * + * @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 all SaaS app operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all SaaS app operations. + * + * @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 all SaaS app operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/ResourceProvidersClient.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..2810e8ebb308 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/ResourceProvidersClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.saas.fluent.models.AccessTokenResultInner; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Gets the ISV access token for a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 ISV access token for a SaaS resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response saasResourceListAccessTokenWithResponse(String resourceId, Context context); + + /** + * Gets the ISV access token for a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 ISV access token for a SaaS resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessTokenResultInner saasResourceListAccessToken(String resourceId); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaaSClient.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaaSClient.java new file mode 100644 index 000000000000..156f85a059b8 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaaSClient.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.saas.fluent.models.SaasResourceInner; +import com.azure.resourcemanager.saas.models.DeleteOptions; +import com.azure.resourcemanager.saas.models.SaasResourceCreation; + +/** An instance of this class provides access to all the operations defined in SaaSClient. */ +public interface SaaSClient { + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas 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 resourceId, DeleteOptions parameters); + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas operation. + * @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 resourceId, DeleteOptions parameters, Context context); + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas 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 resourceId, DeleteOptions parameters); + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas operation. + * @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 resourceId, DeleteOptions parameters, Context context); + + /** + * Gets information about the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 information about the specified SaaS along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getResourceWithResponse(String resourceId, Context context); + + /** + * Gets information about the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 information about the specified SaaS. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner getResource(String resourceId); + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaasResourceInner> beginUpdateResource( + String resourceId, SaasResourceCreation parameters); + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaasResourceInner> beginUpdateResource( + String resourceId, SaasResourceCreation parameters, Context context); + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner updateResource(String resourceId, SaasResourceCreation parameters); + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner updateResource(String resourceId, SaasResourceCreation parameters, Context context); + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaasResourceInner> beginCreateResource(SaasResourceCreation parameters); + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaasResourceInner> beginCreateResource( + SaasResourceCreation parameters, Context context); + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner createResource(SaasResourceCreation parameters); + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner createResource(SaasResourceCreation parameters, Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaaSManagementClient.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaaSManagementClient.java new file mode 100644 index 000000000000..8adc10ccdcb4 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaaSManagementClient.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.saas.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for SaaSManagementClient class. */ +public interface SaaSManagementClient { + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @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 ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + ApplicationsClient getApplications(); + + /** + * Gets the SaaSClient object to access its operations. + * + * @return the SaaSClient object. + */ + SaaSClient getSaaS(); + + /** + * Gets the SaasResourcesClient object to access its operations. + * + * @return the SaasResourcesClient object. + */ + SaasResourcesClient getSaasResources(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the SaasSubscriptionLevelsClient object to access its operations. + * + * @return the SaasSubscriptionLevelsClient object. + */ + SaasSubscriptionLevelsClient getSaasSubscriptionLevels(); + + /** + * Gets the SaaSOperationsClient object to access its operations. + * + * @return the SaaSOperationsClient object. + */ + SaaSOperationsClient getSaaSOperations(); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaaSOperationsClient.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaaSOperationsClient.java new file mode 100644 index 000000000000..111c8739892d --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaaSOperationsClient.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; + +/** An instance of this class provides access to all the operations defined in SaaSOperationsClient. */ +public interface SaaSOperationsClient { + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id parameter. + * @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 information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaasResourceInner> beginGet(String operationId); + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id parameter. + * @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 information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaasResourceInner> beginGet(String operationId, Context context); + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id parameter. + * @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 information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner get(String operationId); + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id parameter. + * @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 information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner get(String operationId, Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaasResourcesClient.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaasResourcesClient.java new file mode 100644 index 000000000000..c248b65ed805 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaasResourcesClient.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.saas.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.saas.fluent.models.SaasResourceInner; + +/** An instance of this class provides access to all the operations defined in SaasResourcesClient. */ +public interface SaasResourcesClient { + /** + * Get All Resources. + * + * @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 all Resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get All Resources. + * + * @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 all Resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaasSubscriptionLevelsClient.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaasSubscriptionLevelsClient.java new file mode 100644 index 000000000000..422e6b57809c --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaasSubscriptionLevelsClient.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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.saas.fluent.models.AccessTokenResultInner; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.azure.resourcemanager.saas.models.DeleteOptions; +import com.azure.resourcemanager.saas.models.MoveResource; +import com.azure.resourcemanager.saas.models.SaasResourceCreation; + +/** An instance of this class provides access to all the operations defined in SaasSubscriptionLevelsClient. */ +public interface SaasSubscriptionLevelsClient { + /** + * Gets information about all the Subscription Level SaaS in a certain Azure subscription. + * + * @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 information about all the Subscription Level SaaS in a certain Azure subscription as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets information about all the Subscription Level SaaS in a certain Azure subscription. + * + * @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 information about all the Subscription Level SaaS in a certain Azure subscription as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets information about all the Subscription Level SaaS in a certain resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 information about all the Subscription Level SaaS in a certain resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets information about all the Subscription Level SaaS in a certain resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 information about all the Subscription Level SaaS in a certain resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 information about the specified Subscription Level SaaS along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 information about the specified Subscription Level SaaS. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaasResourceInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters); + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaasResourceInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context); + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner createOrUpdate(String resourceGroupName, String resourceName, SaasResourceCreation parameters); + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner createOrUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context); + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaasResourceInner> beginUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters); + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaasResourceInner> beginUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context); + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner update(String resourceGroupName, String resourceName, SaasResourceCreation parameters); + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaasResourceInner update( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context); + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName); + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName, Context context); + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName); + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName, Context context); + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas 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> beginUpdateToUnsubscribed( + String resourceGroupName, String resourceName, DeleteOptions parameters); + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas operation. + * @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> beginUpdateToUnsubscribed( + String resourceGroupName, String resourceName, DeleteOptions parameters, Context context); + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas 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 updateToUnsubscribed(String resourceGroupName, String resourceName, DeleteOptions parameters); + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas operation. + * @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 updateToUnsubscribed(String resourceGroupName, String resourceName, DeleteOptions parameters, Context context); + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 ISV access token for a specified Subscription Level SaaS along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listAccessTokenWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 ISV access token for a specified Subscription Level SaaS. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessTokenResultInner listAccessToken(String resourceGroupName, String resourceName); + + /** + * Validate whether a specified Subscription Level SaaS can be moved. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response validateMoveResourcesWithResponse( + String resourceGroupName, MoveResource moveResourceParameter, Context context); + + /** + * Validate whether a specified Subscription Level SaaS can be moved. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 validateMoveResources(String resourceGroupName, MoveResource moveResourceParameter); + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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> beginMoveResources(String resourceGroupName, MoveResource moveResourceParameter); + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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> beginMoveResources( + String resourceGroupName, MoveResource moveResourceParameter, Context context); + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 moveResources(String resourceGroupName, MoveResource moveResourceParameter); + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 moveResources(String resourceGroupName, MoveResource moveResourceParameter, Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/AccessTokenResultInner.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/AccessTokenResultInner.java new file mode 100644 index 000000000000..305e04ef2d41 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/AccessTokenResultInner.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** the ISV access token result response. */ +@Fluent +public final class AccessTokenResultInner { + /* + * The Publisher Offer Base Uri + */ + @JsonProperty(value = "publisherOfferBaseUri") + private String publisherOfferBaseUri; + + /* + * The generated token + */ + @JsonProperty(value = "token") + private String token; + + /** Creates an instance of AccessTokenResultInner class. */ + public AccessTokenResultInner() { + } + + /** + * Get the publisherOfferBaseUri property: The Publisher Offer Base Uri. + * + * @return the publisherOfferBaseUri value. + */ + public String publisherOfferBaseUri() { + return this.publisherOfferBaseUri; + } + + /** + * Set the publisherOfferBaseUri property: The Publisher Offer Base Uri. + * + * @param publisherOfferBaseUri the publisherOfferBaseUri value to set. + * @return the AccessTokenResultInner object itself. + */ + public AccessTokenResultInner withPublisherOfferBaseUri(String publisherOfferBaseUri) { + this.publisherOfferBaseUri = publisherOfferBaseUri; + return this; + } + + /** + * Get the token property: The generated token. + * + * @return the token value. + */ + public String token() { + return this.token; + } + + /** + * Set the token property: The generated token. + * + * @param token the token value to set. + * @return the AccessTokenResultInner object itself. + */ + public AccessTokenResultInner withToken(String token) { + this.token = token; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/SaasAppInner.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/SaasAppInner.java new file mode 100644 index 000000000000..f25d8e9c8b7e --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/SaasAppInner.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.saas.models.SaasAppProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** the saasApp resource. */ +@Fluent +public final class SaasAppInner { + /* + * the resource Id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * the resource location. + */ + @JsonProperty(value = "location") + private String location; + + /* + * the resource name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * the resource type. + */ + @JsonProperty(value = "type") + private String type; + + /* + * the resource properties. + */ + @JsonProperty(value = "properties") + private SaasAppProperties properties; + + /* + * the resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of SaasAppInner class. */ + public SaasAppInner() { + } + + /** + * Get the id property: the resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the location property: the resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: the resource location. + * + * @param location the location value to set. + * @return the SaasAppInner object itself. + */ + public SaasAppInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the name property: the resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: the resource name. + * + * @param name the name value to set. + * @return the SaasAppInner object itself. + */ + public SaasAppInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: the resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: the resource type. + * + * @param type the type value to set. + * @return the SaasAppInner object itself. + */ + public SaasAppInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the properties property: the resource properties. + * + * @return the properties value. + */ + public SaasAppProperties properties() { + return this.properties; + } + + /** + * Set the properties property: the resource properties. + * + * @param properties the properties value to set. + * @return the SaasAppInner object itself. + */ + public SaasAppInner withProperties(SaasAppProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: the resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: the resource tags. + * + * @param tags the tags value to set. + * @return the SaasAppInner object itself. + */ + public SaasAppInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/SaasAppOperationInner.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/SaasAppOperationInner.java new file mode 100644 index 000000000000..a5859474f316 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/SaasAppOperationInner.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.saas.models.SaasAppOperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** saas app operations. */ +@Fluent +public final class SaasAppOperationInner { + /* + * the operation name + */ + @JsonProperty(value = "name") + private String name; + + /* + * the operation display + */ + @JsonProperty(value = "display") + private SaasAppOperationDisplay display; + + /* + * the operation origin + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * whether the operation is a data action or not. + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /** Creates an instance of SaasAppOperationInner class. */ + public SaasAppOperationInner() { + } + + /** + * Get the name property: the operation name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: the operation name. + * + * @param name the name value to set. + * @return the SaasAppOperationInner object itself. + */ + public SaasAppOperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: the operation display. + * + * @return the display value. + */ + public SaasAppOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: the operation display. + * + * @param display the display value to set. + * @return the SaasAppOperationInner object itself. + */ + public SaasAppOperationInner withDisplay(SaasAppOperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: the operation origin. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: the operation origin. + * + * @param origin the origin value to set. + * @return the SaasAppOperationInner object itself. + */ + public SaasAppOperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the isDataAction property: whether the operation is a data action or not. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: whether the operation is a data action or not. + * + * @param isDataAction the isDataAction value to set. + * @return the SaasAppOperationInner object itself. + */ + public SaasAppOperationInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/SaasResourceInner.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/SaasResourceInner.java new file mode 100644 index 000000000000..b8fab78e8d66 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/SaasResourceInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.saas.models.SaasResourceProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** SaaS REST API resource definition. */ +@Fluent +public final class SaasResourceInner extends ProxyResource { + /* + * saas properties + */ + @JsonProperty(value = "properties") + private SaasResourceProperties properties; + + /* + * the resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of SaasResourceInner class. */ + public SaasResourceInner() { + } + + /** + * Get the properties property: saas properties. + * + * @return the properties value. + */ + public SaasResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: saas properties. + * + * @param properties the properties value to set. + * @return the SaasResourceInner object itself. + */ + public SaasResourceInner withProperties(SaasResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: the resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: the resource tags. + * + * @param tags the tags value to set. + * @return the SaasResourceInner object itself. + */ + public SaasResourceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/package-info.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/package-info.java new file mode 100644 index 000000000000..c2a4e2c8f596 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// 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 SaaSManagementClient. REST APIs for Azure Marketplace SaaS Offers. */ +package com.azure.resourcemanager.saas.fluent.models; diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/package-info.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/package-info.java new file mode 100644 index 000000000000..380ba414189b --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/package-info.java @@ -0,0 +1,6 @@ +// 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 SaaSManagementClient. REST APIs for Azure Marketplace SaaS Offers. */ +package com.azure.resourcemanager.saas.fluent; diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/AccessTokenResultImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/AccessTokenResultImpl.java new file mode 100644 index 000000000000..cc2958a54865 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/AccessTokenResultImpl.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.saas.implementation; + +import com.azure.resourcemanager.saas.fluent.models.AccessTokenResultInner; +import com.azure.resourcemanager.saas.models.AccessTokenResult; + +public final class AccessTokenResultImpl implements AccessTokenResult { + private AccessTokenResultInner innerObject; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + AccessTokenResultImpl( + AccessTokenResultInner innerObject, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String publisherOfferBaseUri() { + return this.innerModel().publisherOfferBaseUri(); + } + + public String token() { + return this.innerModel().token(); + } + + public AccessTokenResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ApplicationsClientImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ApplicationsClientImpl.java new file mode 100644 index 000000000000..7238b13e4a97 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ApplicationsClientImpl.java @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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.saas.fluent.ApplicationsClient; +import com.azure.resourcemanager.saas.fluent.models.SaasAppInner; +import com.azure.resourcemanager.saas.models.SaasAppResponseWithContinuation; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ApplicationsClient. */ +public final class ApplicationsClientImpl implements ApplicationsClient { + /** The proxy service used to perform REST calls. */ + private final ApplicationsService service; + + /** The service client containing this operation class. */ + private final SaaSManagementClientImpl client; + + /** + * Initializes an instance of ApplicationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApplicationsClientImpl(SaaSManagementClientImpl client) { + this.service = + RestProxy.create(ApplicationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SaaSManagementClientApplications to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SaaSManagementClient") + public interface ApplicationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/applications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @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); + } + + /** + * Gets all SaaS resources by subscription id and resource group name. + * + * @param resourceGroupName The name of the resource group. + * @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 all SaaS resources by subscription id and resource group name 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.getSubscriptionId(), + resourceGroupName, + 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())); + } + + /** + * Gets all SaaS resources by subscription id and resource group name. + * + * @param resourceGroupName The name of the resource group. + * @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 all SaaS resources by subscription id and resource group name 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.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all SaaS resources by subscription id and resource group name. + * + * @param resourceGroupName The name of the resource group. + * @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 all SaaS resources by subscription id and resource group name as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all SaaS resources by subscription id and resource group name. + * + * @param resourceGroupName The name of the resource group. + * @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 all SaaS resources by subscription id and resource group name as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all SaaS resources by subscription id and resource group name. + * + * @param resourceGroupName The name of the resource group. + * @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 all SaaS resources by subscription id and resource group name as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets all SaaS resources by subscription id and resource group name. + * + * @param resourceGroupName The name of the resource group. + * @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 all SaaS resources by subscription id and resource group name as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, 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 saas app response with continuation 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 saas app response with continuation 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/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ApplicationsImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ApplicationsImpl.java new file mode 100644 index 000000000000..d711c5c2d0f2 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ApplicationsImpl.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.saas.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.saas.fluent.ApplicationsClient; +import com.azure.resourcemanager.saas.fluent.models.SaasAppInner; +import com.azure.resourcemanager.saas.models.Applications; +import com.azure.resourcemanager.saas.models.SaasApp; + +public final class ApplicationsImpl implements Applications { + private static final ClientLogger LOGGER = new ClientLogger(ApplicationsImpl.class); + + private final ApplicationsClient innerClient; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + public ApplicationsImpl(ApplicationsClient innerClient, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new SaasAppImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new SaasAppImpl(inner1, this.manager())); + } + + private ApplicationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/OperationsClientImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..ec755135f5fe --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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.saas.fluent.OperationsClient; +import com.azure.resourcemanager.saas.fluent.models.SaasAppOperationInner; +import com.azure.resourcemanager.saas.models.SaasAppOperationsResponseWithContinuation; +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 SaaSManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(SaaSManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SaaSManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SaaSManagementClient") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.SaaS/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); + } + + /** + * Gets all SaaS app operations. + * + * @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 all SaaS app operations 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())); + } + + /** + * Gets all SaaS app operations. + * + * @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 all SaaS app operations 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)); + } + + /** + * Gets all SaaS app operations. + * + * @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 all SaaS app operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all SaaS app operations. + * + * @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 all SaaS app operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all SaaS app operations. + * + * @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 all SaaS app operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets all SaaS app operations. + * + * @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 all SaaS app operations 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 saas app operation response with continuation 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 saas app operation response with continuation 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/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/OperationsImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/OperationsImpl.java new file mode 100644 index 000000000000..fd7bc874cad4 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/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.saas.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.saas.fluent.OperationsClient; +import com.azure.resourcemanager.saas.fluent.models.SaasAppOperationInner; +import com.azure.resourcemanager.saas.models.Operations; +import com.azure.resourcemanager.saas.models.SaasAppOperation; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SaasAppOperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SaasAppOperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ResourceProvidersClientImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..585595ebdc35 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.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.saas.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.saas.fluent.models.AccessTokenResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final SaaSManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(SaaSManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SaaSManagementClientResourceProviders to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SaaSManagementClient") + public interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.SaaS/saasresources/{resourceId}/listAccessToken") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> saasResourceListAccessToken( + @HostParam("$host") String endpoint, + @PathParam("resourceId") String resourceId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the ISV access token for a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 ISV access token for a SaaS resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> saasResourceListAccessTokenWithResponseAsync(String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .saasResourceListAccessToken( + this.client.getEndpoint(), resourceId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the ISV access token for a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 ISV access token for a SaaS resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> saasResourceListAccessTokenWithResponseAsync( + String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .saasResourceListAccessToken( + this.client.getEndpoint(), resourceId, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the ISV access token for a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 ISV access token for a SaaS resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono saasResourceListAccessTokenAsync(String resourceId) { + return saasResourceListAccessTokenWithResponseAsync(resourceId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the ISV access token for a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 ISV access token for a SaaS resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response saasResourceListAccessTokenWithResponse( + String resourceId, Context context) { + return saasResourceListAccessTokenWithResponseAsync(resourceId, context).block(); + } + + /** + * Gets the ISV access token for a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 ISV access token for a SaaS resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessTokenResultInner saasResourceListAccessToken(String resourceId) { + return saasResourceListAccessTokenWithResponse(resourceId, Context.NONE).getValue(); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ResourceProvidersImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..879234aa7c4c --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ResourceProvidersImpl.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.saas.implementation; + +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.saas.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.saas.fluent.models.AccessTokenResultInner; +import com.azure.resourcemanager.saas.models.AccessTokenResult; +import com.azure.resourcemanager.saas.models.ResourceProviders; + +public final class ResourceProvidersImpl implements ResourceProviders { + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response saasResourceListAccessTokenWithResponse(String resourceId, Context context) { + Response inner = + this.serviceClient().saasResourceListAccessTokenWithResponse(resourceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccessTokenResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AccessTokenResult saasResourceListAccessToken(String resourceId) { + AccessTokenResultInner inner = this.serviceClient().saasResourceListAccessToken(resourceId); + if (inner != null) { + return new AccessTokenResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSClientImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSClientImpl.java new file mode 100644 index 000000000000..c51b2c9ed1a3 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSClientImpl.java @@ -0,0 +1,859 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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.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.saas.fluent.SaaSClient; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.azure.resourcemanager.saas.models.DeleteOptions; +import com.azure.resourcemanager.saas.models.SaasResourceCreation; +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 SaaSClient. */ +public final class SaaSClientImpl implements SaaSClient { + /** The proxy service used to perform REST calls. */ + private final SaaSService service; + + /** The service client containing this operation class. */ + private final SaaSManagementClientImpl client; + + /** + * Initializes an instance of SaaSClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SaaSClientImpl(SaaSManagementClientImpl client) { + this.service = RestProxy.create(SaaSService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SaaSManagementClientSaaS to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SaaSManagementClient") + public interface SaaSService { + @Headers({"Content-Type: application/json"}) + @Delete("/providers/Microsoft.SaaS/saasresources/{resourceId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceId") String resourceId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DeleteOptions parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.SaaS/saasresources/{resourceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getResource( + @HostParam("$host") String endpoint, + @PathParam("resourceId") String resourceId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/providers/Microsoft.SaaS/saasresources/{resourceId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateResource( + @HostParam("$host") String endpoint, + @PathParam("resourceId") String resourceId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SaasResourceCreation parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.SaaS/saasresources") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createResource( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SaasResourceCreation parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas 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 resourceId, DeleteOptions parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceId, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas operation. + * @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 resourceId, DeleteOptions parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), resourceId, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas 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 resourceId, DeleteOptions parameters) { + Mono>> mono = deleteWithResponseAsync(resourceId, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas operation. + * @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 resourceId, DeleteOptions parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceId, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas 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 resourceId, DeleteOptions parameters) { + return this.beginDeleteAsync(resourceId, parameters).getSyncPoller(); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas operation. + * @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 resourceId, DeleteOptions parameters, Context context) { + return this.beginDeleteAsync(resourceId, parameters, context).getSyncPoller(); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas 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 resourceId, DeleteOptions parameters) { + return beginDeleteAsync(resourceId, parameters).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas operation. + * @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 resourceId, DeleteOptions parameters, Context context) { + return beginDeleteAsync(resourceId, parameters, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas 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 resourceId, DeleteOptions parameters) { + deleteAsync(resourceId, parameters).block(); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas operation. + * @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 resourceId, DeleteOptions parameters, Context context) { + deleteAsync(resourceId, parameters, context).block(); + } + + /** + * Gets information about the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 information about the specified SaaS along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourceWithResponseAsync(String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getResource( + this.client.getEndpoint(), resourceId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 information about the specified SaaS along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourceWithResponseAsync(String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getResource(this.client.getEndpoint(), resourceId, this.client.getApiVersion(), accept, context); + } + + /** + * Gets information about the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 information about the specified SaaS on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getResourceAsync(String resourceId) { + return getResourceWithResponseAsync(resourceId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 information about the specified SaaS along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getResourceWithResponse(String resourceId, Context context) { + return getResourceWithResponseAsync(resourceId, context).block(); + } + + /** + * Gets information about the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 information about the specified SaaS. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner getResource(String resourceId) { + return getResourceWithResponse(resourceId, Context.NONE).getValue(); + } + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateResourceWithResponseAsync( + String resourceId, SaasResourceCreation parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateResource( + this.client.getEndpoint(), + resourceId, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateResourceWithResponseAsync( + String resourceId, SaasResourceCreation parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateResource( + this.client.getEndpoint(), resourceId, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaasResourceInner> beginUpdateResourceAsync( + String resourceId, SaasResourceCreation parameters) { + Mono>> mono = updateResourceWithResponseAsync(resourceId, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SaasResourceInner.class, + SaasResourceInner.class, + this.client.getContext()); + } + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaasResourceInner> beginUpdateResourceAsync( + String resourceId, SaasResourceCreation parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateResourceWithResponseAsync(resourceId, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SaasResourceInner.class, SaasResourceInner.class, context); + } + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginUpdateResource( + String resourceId, SaasResourceCreation parameters) { + return this.beginUpdateResourceAsync(resourceId, parameters).getSyncPoller(); + } + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginUpdateResource( + String resourceId, SaasResourceCreation parameters, Context context) { + return this.beginUpdateResourceAsync(resourceId, parameters, context).getSyncPoller(); + } + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateResourceAsync(String resourceId, SaasResourceCreation parameters) { + return beginUpdateResourceAsync(resourceId, parameters).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateResourceAsync( + String resourceId, SaasResourceCreation parameters, Context context) { + return beginUpdateResourceAsync(resourceId, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner updateResource(String resourceId, SaasResourceCreation parameters) { + return updateResourceAsync(resourceId, parameters).block(); + } + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner updateResource(String resourceId, SaasResourceCreation parameters, Context context) { + return updateResourceAsync(resourceId, parameters, context).block(); + } + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas 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 saaS REST API resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createResourceWithResponseAsync(SaasResourceCreation parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createResource( + this.client.getEndpoint(), this.client.getApiVersion(), parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas operation. + * @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 saaS REST API resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createResourceWithResponseAsync( + SaasResourceCreation parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createResource(this.client.getEndpoint(), this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaasResourceInner> beginCreateResourceAsync( + SaasResourceCreation parameters) { + Mono>> mono = createResourceWithResponseAsync(parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SaasResourceInner.class, + SaasResourceInner.class, + this.client.getContext()); + } + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaasResourceInner> beginCreateResourceAsync( + SaasResourceCreation parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createResourceWithResponseAsync(parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SaasResourceInner.class, SaasResourceInner.class, context); + } + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginCreateResource( + SaasResourceCreation parameters) { + return this.beginCreateResourceAsync(parameters).getSyncPoller(); + } + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginCreateResource( + SaasResourceCreation parameters, Context context) { + return this.beginCreateResourceAsync(parameters, context).getSyncPoller(); + } + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas 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 saaS REST API resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createResourceAsync(SaasResourceCreation parameters) { + return beginCreateResourceAsync(parameters).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas operation. + * @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 saaS REST API resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createResourceAsync(SaasResourceCreation parameters, Context context) { + return beginCreateResourceAsync(parameters, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner createResource(SaasResourceCreation parameters) { + return createResourceAsync(parameters).block(); + } + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner createResource(SaasResourceCreation parameters, Context context) { + return createResourceAsync(parameters, context).block(); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSImpl.java new file mode 100644 index 000000000000..fe0989efc60e --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSImpl.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.implementation; + +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.saas.fluent.SaaSClient; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.azure.resourcemanager.saas.models.DeleteOptions; +import com.azure.resourcemanager.saas.models.SaaS; +import com.azure.resourcemanager.saas.models.SaasResource; +import com.azure.resourcemanager.saas.models.SaasResourceCreation; + +public final class SaaSImpl implements SaaS { + private static final ClientLogger LOGGER = new ClientLogger(SaaSImpl.class); + + private final SaaSClient innerClient; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + public SaaSImpl(SaaSClient innerClient, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceId, DeleteOptions parameters) { + this.serviceClient().delete(resourceId, parameters); + } + + public void delete(String resourceId, DeleteOptions parameters, Context context) { + this.serviceClient().delete(resourceId, parameters, context); + } + + public Response getResourceWithResponse(String resourceId, Context context) { + Response inner = this.serviceClient().getResourceWithResponse(resourceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SaasResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SaasResource getResource(String resourceId) { + SaasResourceInner inner = this.serviceClient().getResource(resourceId); + if (inner != null) { + return new SaasResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SaasResource updateResource(String resourceId, SaasResourceCreation parameters) { + SaasResourceInner inner = this.serviceClient().updateResource(resourceId, parameters); + if (inner != null) { + return new SaasResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SaasResource updateResource(String resourceId, SaasResourceCreation parameters, Context context) { + SaasResourceInner inner = this.serviceClient().updateResource(resourceId, parameters, context); + if (inner != null) { + return new SaasResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SaasResource createResource(SaasResourceCreation parameters) { + SaasResourceInner inner = this.serviceClient().createResource(parameters); + if (inner != null) { + return new SaasResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SaasResource createResource(SaasResourceCreation parameters, Context context) { + SaasResourceInner inner = this.serviceClient().createResource(parameters, context); + if (inner != null) { + return new SaasResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private SaaSClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSManagementClientBuilder.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSManagementClientBuilder.java new file mode 100644 index 000000000000..54abbbe96148 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSManagementClientBuilder.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.saas.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 SaaSManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {SaaSManagementClientImpl.class}) +public final class SaaSManagementClientBuilder { + /* + * The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the SaaSManagementClientBuilder. + */ + public SaaSManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the SaaSManagementClientBuilder. + */ + public SaaSManagementClientBuilder 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 SaaSManagementClientBuilder. + */ + public SaaSManagementClientBuilder 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 SaaSManagementClientBuilder. + */ + public SaaSManagementClientBuilder 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 SaaSManagementClientBuilder. + */ + public SaaSManagementClientBuilder 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 SaaSManagementClientBuilder. + */ + public SaaSManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of SaaSManagementClientImpl with the provided parameters. + * + * @return an instance of SaaSManagementClientImpl. + */ + public SaaSManagementClientImpl 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(); + SaaSManagementClientImpl client = + new SaaSManagementClientImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSManagementClientImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSManagementClientImpl.java new file mode 100644 index 000000000000..3da9ef76ffb4 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSManagementClientImpl.java @@ -0,0 +1,375 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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.saas.fluent.ApplicationsClient; +import com.azure.resourcemanager.saas.fluent.OperationsClient; +import com.azure.resourcemanager.saas.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.saas.fluent.SaaSClient; +import com.azure.resourcemanager.saas.fluent.SaaSManagementClient; +import com.azure.resourcemanager.saas.fluent.SaaSOperationsClient; +import com.azure.resourcemanager.saas.fluent.SaasResourcesClient; +import com.azure.resourcemanager.saas.fluent.SaasSubscriptionLevelsClient; +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 SaaSManagementClientImpl type. */ +@ServiceClient(builder = SaaSManagementClientBuilder.class) +public final class SaaSManagementClientImpl implements SaaSManagementClient { + /** The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @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 ApplicationsClient object to access its operations. */ + private final ApplicationsClient applications; + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + public ApplicationsClient getApplications() { + return this.applications; + } + + /** The SaaSClient object to access its operations. */ + private final SaaSClient saaS; + + /** + * Gets the SaaSClient object to access its operations. + * + * @return the SaaSClient object. + */ + public SaaSClient getSaaS() { + return this.saaS; + } + + /** The SaasResourcesClient object to access its operations. */ + private final SaasResourcesClient saasResources; + + /** + * Gets the SaasResourcesClient object to access its operations. + * + * @return the SaasResourcesClient object. + */ + public SaasResourcesClient getSaasResources() { + return this.saasResources; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The SaasSubscriptionLevelsClient object to access its operations. */ + private final SaasSubscriptionLevelsClient saasSubscriptionLevels; + + /** + * Gets the SaasSubscriptionLevelsClient object to access its operations. + * + * @return the SaasSubscriptionLevelsClient object. + */ + public SaasSubscriptionLevelsClient getSaasSubscriptionLevels() { + return this.saasSubscriptionLevels; + } + + /** The SaaSOperationsClient object to access its operations. */ + private final SaaSOperationsClient saaSOperations; + + /** + * Gets the SaaSOperationsClient object to access its operations. + * + * @return the SaaSOperationsClient object. + */ + public SaaSOperationsClient getSaaSOperations() { + return this.saaSOperations; + } + + /** + * Initializes an instance of SaaSManagementClient 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 Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + SaaSManagementClientImpl( + 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 = "2018-03-01-beta"; + this.operations = new OperationsClientImpl(this); + this.applications = new ApplicationsClientImpl(this); + this.saaS = new SaaSClientImpl(this); + this.saasResources = new SaasResourcesClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.saasSubscriptionLevels = new SaasSubscriptionLevelsClientImpl(this); + this.saaSOperations = new SaaSOperationsClientImpl(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(SaaSManagementClientImpl.class); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSOperationsClientImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSOperationsClientImpl.java new file mode 100644 index 000000000000..e60bd8f595cf --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSOperationsClientImpl.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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.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.saas.fluent.SaaSOperationsClient; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +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 SaaSOperationsClient. */ +public final class SaaSOperationsClientImpl implements SaaSOperationsClient { + /** The proxy service used to perform REST calls. */ + private final SaaSOperationsService service; + + /** The service client containing this operation class. */ + private final SaaSManagementClientImpl client; + + /** + * Initializes an instance of SaaSOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SaaSOperationsClientImpl(SaaSManagementClientImpl client) { + this.service = + RestProxy.create(SaaSOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SaaSManagementClientSaaSOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SaaSManagementClient") + public interface SaaSOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.SaaS/operationResults/{operationId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> get( + @HostParam("$host") String endpoint, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id 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 information about the specified operation progress along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getWithResponseAsync(String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.get(this.client.getEndpoint(), operationId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id 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 information about the specified operation progress along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getWithResponseAsync(String operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), operationId, this.client.getApiVersion(), accept, context); + } + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id 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 {@link PollerFlux} for polling of information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaasResourceInner> beginGetAsync(String operationId) { + Mono>> mono = getWithResponseAsync(operationId); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SaasResourceInner.class, + SaasResourceInner.class, + this.client.getContext()); + } + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id 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 {@link PollerFlux} for polling of information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaasResourceInner> beginGetAsync( + String operationId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = getWithResponseAsync(operationId, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SaasResourceInner.class, SaasResourceInner.class, context); + } + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id 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 {@link SyncPoller} for polling of information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginGet(String operationId) { + return this.beginGetAsync(operationId).getSyncPoller(); + } + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id 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 {@link SyncPoller} for polling of information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginGet(String operationId, Context context) { + return this.beginGetAsync(operationId, context).getSyncPoller(); + } + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id 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 information about the specified operation progress on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String operationId) { + return beginGetAsync(operationId).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id 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 information about the specified operation progress on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String operationId, Context context) { + return beginGetAsync(operationId, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id 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 information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner get(String operationId) { + return getAsync(operationId).block(); + } + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id 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 information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner get(String operationId, Context context) { + return getAsync(operationId, context).block(); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSOperationsImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSOperationsImpl.java new file mode 100644 index 000000000000..00dedda3d0ac --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSOperationsImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.saas.fluent.SaaSOperationsClient; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.azure.resourcemanager.saas.models.SaaSOperations; +import com.azure.resourcemanager.saas.models.SaasResource; + +public final class SaaSOperationsImpl implements SaaSOperations { + private static final ClientLogger LOGGER = new ClientLogger(SaaSOperationsImpl.class); + + private final SaaSOperationsClient innerClient; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + public SaaSOperationsImpl( + SaaSOperationsClient innerClient, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SaasResource get(String operationId) { + SaasResourceInner inner = this.serviceClient().get(operationId); + if (inner != null) { + return new SaasResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SaasResource get(String operationId, Context context) { + SaasResourceInner inner = this.serviceClient().get(operationId, context); + if (inner != null) { + return new SaasResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private SaaSOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasAppImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasAppImpl.java new file mode 100644 index 000000000000..ecb3590558a8 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasAppImpl.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.saas.implementation; + +import com.azure.resourcemanager.saas.fluent.models.SaasAppInner; +import com.azure.resourcemanager.saas.models.SaasApp; +import com.azure.resourcemanager.saas.models.SaasAppProperties; +import java.util.Collections; +import java.util.Map; + +public final class SaasAppImpl implements SaasApp { + private SaasAppInner innerObject; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + SaasAppImpl(SaasAppInner innerObject, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String location() { + return this.innerModel().location(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SaasAppProperties properties() { + return this.innerModel().properties(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SaasAppInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasAppOperationImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasAppOperationImpl.java new file mode 100644 index 000000000000..1afeb41ef7c6 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasAppOperationImpl.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.saas.implementation; + +import com.azure.resourcemanager.saas.fluent.models.SaasAppOperationInner; +import com.azure.resourcemanager.saas.models.SaasAppOperation; +import com.azure.resourcemanager.saas.models.SaasAppOperationDisplay; + +public final class SaasAppOperationImpl implements SaasAppOperation { + private SaasAppOperationInner innerObject; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + SaasAppOperationImpl(SaasAppOperationInner innerObject, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public SaasAppOperationDisplay display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public SaasAppOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourceImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourceImpl.java new file mode 100644 index 000000000000..f35eb7738176 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourceImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.azure.resourcemanager.saas.models.AccessTokenResult; +import com.azure.resourcemanager.saas.models.DeleteOptions; +import com.azure.resourcemanager.saas.models.SaasCreationProperties; +import com.azure.resourcemanager.saas.models.SaasResource; +import com.azure.resourcemanager.saas.models.SaasResourceCreation; +import com.azure.resourcemanager.saas.models.SaasResourceProperties; +import java.util.Collections; +import java.util.Map; + +public final class SaasResourceImpl implements SaasResource, SaasResource.Definition, SaasResource.Update { + private SaasResourceInner innerObject; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SaasResourceProperties properties() { + return this.innerModel().properties(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SaasResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private SaasResourceCreation createParameters; + + private SaasResourceCreation updateParameters; + + public SaasResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SaasResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getSaasSubscriptionLevels() + .createOrUpdate(resourceGroupName, resourceName, createParameters, Context.NONE); + return this; + } + + public SaasResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSaasSubscriptionLevels() + .createOrUpdate(resourceGroupName, resourceName, createParameters, context); + return this; + } + + SaasResourceImpl(String name, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerObject = new SaasResourceInner(); + this.serviceManager = serviceManager; + this.resourceName = name; + this.createParameters = new SaasResourceCreation(); + } + + public SaasResourceImpl update() { + this.updateParameters = new SaasResourceCreation(); + return this; + } + + public SaasResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSaasSubscriptionLevels() + .update(resourceGroupName, resourceName, updateParameters, Context.NONE); + return this; + } + + public SaasResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSaasSubscriptionLevels() + .update(resourceGroupName, resourceName, updateParameters, context); + return this; + } + + SaasResourceImpl(SaasResourceInner innerObject, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "resources"); + } + + public SaasResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSaasSubscriptionLevels() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE) + .getValue(); + return this; + } + + public SaasResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSaasSubscriptionLevels() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, context) + .getValue(); + return this; + } + + public void updateToUnsubscribed(DeleteOptions parameters) { + serviceManager.saasSubscriptionLevels().updateToUnsubscribed(resourceGroupName, resourceName, parameters); + } + + public void updateToUnsubscribed(DeleteOptions parameters, Context context) { + serviceManager + .saasSubscriptionLevels() + .updateToUnsubscribed(resourceGroupName, resourceName, parameters, context); + } + + public Response listAccessTokenWithResponse(Context context) { + return serviceManager + .saasSubscriptionLevels() + .listAccessTokenWithResponse(resourceGroupName, resourceName, context); + } + + public AccessTokenResult listAccessToken() { + return serviceManager.saasSubscriptionLevels().listAccessToken(resourceGroupName, resourceName); + } + + public SaasResourceImpl withRegion(Region location) { + this.createParameters.withLocation(location.toString()); + return this; + } + + public SaasResourceImpl withRegion(String location) { + this.createParameters.withLocation(location); + return this; + } + + public SaasResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createParameters.withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public SaasResourceImpl withName(String name) { + if (isInCreateMode()) { + this.createParameters.withName(name); + return this; + } else { + this.updateParameters.withName(name); + return this; + } + } + + public SaasResourceImpl withProperties(SaasCreationProperties properties) { + if (isInCreateMode()) { + this.createParameters.withProperties(properties); + return this; + } else { + this.updateParameters.withProperties(properties); + return this; + } + } + + public SaasResourceImpl withLocation(String location) { + this.updateParameters.withLocation(location); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourcesClientImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourcesClientImpl.java new file mode 100644 index 000000000000..d4475151740c --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourcesClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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.saas.fluent.SaasResourcesClient; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.azure.resourcemanager.saas.models.SaasResourceResponseWithContinuation; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SaasResourcesClient. */ +public final class SaasResourcesClientImpl implements SaasResourcesClient { + /** The proxy service used to perform REST calls. */ + private final SaasResourcesService service; + + /** The service client containing this operation class. */ + private final SaaSManagementClientImpl client; + + /** + * Initializes an instance of SaasResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SaasResourcesClientImpl(SaaSManagementClientImpl client) { + this.service = + RestProxy.create(SaasResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SaaSManagementClientSaasResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SaaSManagementClient") + public interface SaasResourcesService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.SaaS/saasresources") + @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); + } + + /** + * Get All Resources. + * + * @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 all Resources 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())); + } + + /** + * Get All Resources. + * + * @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 all Resources 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)); + } + + /** + * Get All Resources. + * + * @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 all Resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get All Resources. + * + * @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 all Resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get All Resources. + * + * @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 all Resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get All Resources. + * + * @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 all Resources 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 saas resources response with continuation 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 saas resources response with continuation 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/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourcesImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourcesImpl.java new file mode 100644 index 000000000000..e423e3330b3d --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourcesImpl.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.saas.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.saas.fluent.SaasResourcesClient; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.azure.resourcemanager.saas.models.SaasResource; +import com.azure.resourcemanager.saas.models.SaasResources; + +public final class SaasResourcesImpl implements SaasResources { + private static final ClientLogger LOGGER = new ClientLogger(SaasResourcesImpl.class); + + private final SaasResourcesClient innerClient; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + public SaasResourcesImpl( + SaasResourcesClient innerClient, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SaasResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SaasResourceImpl(inner1, this.manager())); + } + + private SaasResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasSubscriptionLevelsClientImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasSubscriptionLevelsClientImpl.java new file mode 100644 index 000000000000..282a2b5b6711 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasSubscriptionLevelsClientImpl.java @@ -0,0 +1,2397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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.Post; +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.saas.fluent.SaasSubscriptionLevelsClient; +import com.azure.resourcemanager.saas.fluent.models.AccessTokenResultInner; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.azure.resourcemanager.saas.models.DeleteOptions; +import com.azure.resourcemanager.saas.models.MoveResource; +import com.azure.resourcemanager.saas.models.SaasResourceCreation; +import com.azure.resourcemanager.saas.models.SaasResourceResponseWithContinuation; +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 SaasSubscriptionLevelsClient. */ +public final class SaasSubscriptionLevelsClientImpl implements SaasSubscriptionLevelsClient { + /** The proxy service used to perform REST calls. */ + private final SaasSubscriptionLevelsService service; + + /** The service client containing this operation class. */ + private final SaaSManagementClientImpl client; + + /** + * Initializes an instance of SaasSubscriptionLevelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SaasSubscriptionLevelsClientImpl(SaaSManagementClientImpl client) { + this.service = + RestProxy + .create(SaasSubscriptionLevelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SaaSManagementClientSaasSubscriptionLevels to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SaaSManagementClient") + public interface SaasSubscriptionLevelsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.SaaS/resources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources/{resourceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SaasResourceCreation parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources/{resourceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SaasResourceCreation parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources/{resourceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources/{resourceName}/unsubscribe") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateToUnsubscribed( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DeleteOptions parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources/{resourceName}/listAccessToken") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAccessToken( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> validateMoveResources( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MoveResource moveResourceParameter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> moveResources( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MoveResource moveResourceParameter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAzureSubscriptionNext( + @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); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain Azure subscription. + * + * @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 information about all the Subscription Level SaaS in a certain Azure subscription 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.getSubscriptionId(), + 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())); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain Azure subscription. + * + * @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 information about all the Subscription Level SaaS in a certain Azure subscription 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.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain Azure subscription. + * + * @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 information about all the Subscription Level SaaS in a certain Azure subscription as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listByAzureSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain Azure subscription. + * + * @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 information about all the Subscription Level SaaS in a certain Azure subscription as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), + nextLink -> listByAzureSubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain Azure subscription. + * + * @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 information about all the Subscription Level SaaS in a certain Azure subscription as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain Azure subscription. + * + * @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 information about all the Subscription Level SaaS in a certain Azure subscription as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 information about all the Subscription Level SaaS in a certain resource group 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.getSubscriptionId(), + resourceGroupName, + 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())); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 information about all the Subscription Level SaaS in a certain resource group 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.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 information about all the Subscription Level SaaS in a certain resource group as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 information about all the Subscription Level SaaS in a certain resource group 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)); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 information about all the Subscription Level SaaS in a certain resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets information about all the Subscription Level SaaS in a certain resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 information about all the Subscription Level SaaS in a certain resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 information about the specified Subscription Level SaaS along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 information about the specified Subscription Level SaaS along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 information about the specified Subscription Level SaaS on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 information about the specified Subscription Level SaaS along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 information about the specified Subscription Level SaaS. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); + } + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas 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 saaS REST API resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas operation. + * @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 saaS REST API resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaasResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SaasResourceInner.class, + SaasResourceInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaasResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SaasResourceInner.class, SaasResourceInner.class, context); + } + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + return this.beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas 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 saaS REST API resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas operation. + * @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 saaS REST API resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner createOrUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + return createOrUpdateAsync(resourceGroupName, resourceName, parameters).block(); + } + + /** + * Creates or updates a SaaS resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the create or update subscription level saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner createOrUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, resourceName, parameters, context).block(); + } + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaasResourceInner> beginUpdateAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, resourceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SaasResourceInner.class, + SaasResourceInner.class, + this.client.getContext()); + } + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaasResourceInner> beginUpdateAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, resourceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SaasResourceInner.class, SaasResourceInner.class, context); + } + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + return this.beginUpdateAsync(resourceGroupName, resourceName, parameters).getSyncPoller(); + } + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context) { + return this.beginUpdateAsync(resourceGroupName, resourceName, parameters, context).getSyncPoller(); + } + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + return beginUpdateAsync(resourceGroupName, resourceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context) { + return beginUpdateAsync(resourceGroupName, resourceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner update(String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + return updateAsync(resourceGroupName, resourceName, parameters).block(); + } + + /** + * Updates a SaaS Subscription Level resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaasResourceInner update( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context) { + return updateAsync(resourceGroupName, resourceName, parameters, context).block(); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName) { + return this.beginDeleteAsync(resourceGroupName, resourceName).getSyncPoller(); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName, Context context) { + return this.beginDeleteAsync(resourceGroupName, resourceName, context).getSyncPoller(); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName) { + return beginDeleteAsync(resourceGroupName, resourceName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName) { + deleteAsync(resourceGroupName, resourceName).block(); + } + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName, Context context) { + deleteAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas 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>> updateToUnsubscribedWithResponseAsync( + String resourceGroupName, String resourceName, DeleteOptions parameters) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateToUnsubscribed( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas operation. + * @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>> updateToUnsubscribedWithResponseAsync( + String resourceGroupName, String resourceName, DeleteOptions parameters, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateToUnsubscribed( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas 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> beginUpdateToUnsubscribedAsync( + String resourceGroupName, String resourceName, DeleteOptions parameters) { + Mono>> mono = + updateToUnsubscribedWithResponseAsync(resourceGroupName, resourceName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas operation. + * @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> beginUpdateToUnsubscribedAsync( + String resourceGroupName, String resourceName, DeleteOptions parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateToUnsubscribedWithResponseAsync(resourceGroupName, resourceName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas 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> beginUpdateToUnsubscribed( + String resourceGroupName, String resourceName, DeleteOptions parameters) { + return this.beginUpdateToUnsubscribedAsync(resourceGroupName, resourceName, parameters).getSyncPoller(); + } + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas operation. + * @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> beginUpdateToUnsubscribed( + String resourceGroupName, String resourceName, DeleteOptions parameters, Context context) { + return this + .beginUpdateToUnsubscribedAsync(resourceGroupName, resourceName, parameters, context) + .getSyncPoller(); + } + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas 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 updateToUnsubscribedAsync( + String resourceGroupName, String resourceName, DeleteOptions parameters) { + return beginUpdateToUnsubscribedAsync(resourceGroupName, resourceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas operation. + * @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 updateToUnsubscribedAsync( + String resourceGroupName, String resourceName, DeleteOptions parameters, Context context) { + return beginUpdateToUnsubscribedAsync(resourceGroupName, resourceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas 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 updateToUnsubscribed(String resourceGroupName, String resourceName, DeleteOptions parameters) { + updateToUnsubscribedAsync(resourceGroupName, resourceName, parameters).block(); + } + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas operation. + * @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 updateToUnsubscribed( + String resourceGroupName, String resourceName, DeleteOptions parameters, Context context) { + updateToUnsubscribedAsync(resourceGroupName, resourceName, parameters, context).block(); + } + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 ISV access token for a specified Subscription Level SaaS along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAccessTokenWithResponseAsync( + String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAccessToken( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 ISV access token for a specified Subscription Level SaaS along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAccessTokenWithResponseAsync( + String resourceGroupName, String resourceName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAccessToken( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 ISV access token for a specified Subscription Level SaaS on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAccessTokenAsync(String resourceGroupName, String resourceName) { + return listAccessTokenWithResponseAsync(resourceGroupName, resourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 ISV access token for a specified Subscription Level SaaS along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAccessTokenWithResponse( + String resourceGroupName, String resourceName, Context context) { + return listAccessTokenWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 ISV access token for a specified Subscription Level SaaS. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessTokenResultInner listAccessToken(String resourceGroupName, String resourceName) { + return listAccessTokenWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); + } + + /** + * Validate whether a specified Subscription Level SaaS can be moved. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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> validateMoveResourcesWithResponseAsync( + String resourceGroupName, MoveResource moveResourceParameter) { + 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 (moveResourceParameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter moveResourceParameter is required and cannot be null.")); + } else { + moveResourceParameter.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .validateMoveResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + moveResourceParameter, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validate whether a specified Subscription Level SaaS can be moved. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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> validateMoveResourcesWithResponseAsync( + String resourceGroupName, MoveResource moveResourceParameter, 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 (moveResourceParameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter moveResourceParameter is required and cannot be null.")); + } else { + moveResourceParameter.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .validateMoveResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + moveResourceParameter, + accept, + context); + } + + /** + * Validate whether a specified Subscription Level SaaS can be moved. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 validateMoveResourcesAsync(String resourceGroupName, MoveResource moveResourceParameter) { + return validateMoveResourcesWithResponseAsync(resourceGroupName, moveResourceParameter) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Validate whether a specified Subscription Level SaaS can be moved. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validateMoveResourcesWithResponse( + String resourceGroupName, MoveResource moveResourceParameter, Context context) { + return validateMoveResourcesWithResponseAsync(resourceGroupName, moveResourceParameter, context).block(); + } + + /** + * Validate whether a specified Subscription Level SaaS can be moved. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 validateMoveResources(String resourceGroupName, MoveResource moveResourceParameter) { + validateMoveResourcesWithResponse(resourceGroupName, moveResourceParameter, Context.NONE); + } + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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>> moveResourcesWithResponseAsync( + String resourceGroupName, MoveResource moveResourceParameter) { + 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 (moveResourceParameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter moveResourceParameter is required and cannot be null.")); + } else { + moveResourceParameter.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .moveResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + moveResourceParameter, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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>> moveResourcesWithResponseAsync( + String resourceGroupName, MoveResource moveResourceParameter, 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 (moveResourceParameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter moveResourceParameter is required and cannot be null.")); + } else { + moveResourceParameter.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .moveResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + moveResourceParameter, + accept, + context); + } + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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> beginMoveResourcesAsync( + String resourceGroupName, MoveResource moveResourceParameter) { + Mono>> mono = + moveResourcesWithResponseAsync(resourceGroupName, moveResourceParameter); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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> beginMoveResourcesAsync( + String resourceGroupName, MoveResource moveResourceParameter, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + moveResourcesWithResponseAsync(resourceGroupName, moveResourceParameter, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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> beginMoveResources( + String resourceGroupName, MoveResource moveResourceParameter) { + return this.beginMoveResourcesAsync(resourceGroupName, moveResourceParameter).getSyncPoller(); + } + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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> beginMoveResources( + String resourceGroupName, MoveResource moveResourceParameter, Context context) { + return this.beginMoveResourcesAsync(resourceGroupName, moveResourceParameter, context).getSyncPoller(); + } + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 moveResourcesAsync(String resourceGroupName, MoveResource moveResourceParameter) { + return beginMoveResourcesAsync(resourceGroupName, moveResourceParameter) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 moveResourcesAsync( + String resourceGroupName, MoveResource moveResourceParameter, Context context) { + return beginMoveResourcesAsync(resourceGroupName, moveResourceParameter, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 moveResources(String resourceGroupName, MoveResource moveResourceParameter) { + moveResourcesAsync(resourceGroupName, moveResourceParameter).block(); + } + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 moveResources(String resourceGroupName, MoveResource moveResourceParameter, Context context) { + moveResourcesAsync(resourceGroupName, moveResourceParameter, 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 saas resources response with continuation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAzureSubscriptionNextSinglePageAsync(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.listByAzureSubscriptionNext(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 saas resources response with continuation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAzureSubscriptionNextSinglePageAsync( + 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 + .listByAzureSubscriptionNext(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 saas resources response with continuation 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 saas resources response with continuation 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/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasSubscriptionLevelsImpl.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasSubscriptionLevelsImpl.java new file mode 100644 index 000000000000..82b92774057f --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasSubscriptionLevelsImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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.saas.fluent.SaasSubscriptionLevelsClient; +import com.azure.resourcemanager.saas.fluent.models.AccessTokenResultInner; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.azure.resourcemanager.saas.models.AccessTokenResult; +import com.azure.resourcemanager.saas.models.DeleteOptions; +import com.azure.resourcemanager.saas.models.MoveResource; +import com.azure.resourcemanager.saas.models.SaasResource; +import com.azure.resourcemanager.saas.models.SaasSubscriptionLevels; + +public final class SaasSubscriptionLevelsImpl implements SaasSubscriptionLevels { + private static final ClientLogger LOGGER = new ClientLogger(SaasSubscriptionLevelsImpl.class); + + private final SaasSubscriptionLevelsClient innerClient; + + private final com.azure.resourcemanager.saas.SaaSManager serviceManager; + + public SaasSubscriptionLevelsImpl( + SaasSubscriptionLevelsClient innerClient, com.azure.resourcemanager.saas.SaaSManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SaasResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SaasResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new SaasResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new SaasResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SaasResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SaasResource getByResourceGroup(String resourceGroupName, String resourceName) { + SaasResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName); + if (inner != null) { + return new SaasResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String resourceName) { + this.serviceClient().delete(resourceGroupName, resourceName); + } + + public void delete(String resourceGroupName, String resourceName, Context context) { + this.serviceClient().delete(resourceGroupName, resourceName, context); + } + + public void updateToUnsubscribed(String resourceGroupName, String resourceName, DeleteOptions parameters) { + this.serviceClient().updateToUnsubscribed(resourceGroupName, resourceName, parameters); + } + + public void updateToUnsubscribed( + String resourceGroupName, String resourceName, DeleteOptions parameters, Context context) { + this.serviceClient().updateToUnsubscribed(resourceGroupName, resourceName, parameters, context); + } + + public Response listAccessTokenWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().listAccessTokenWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccessTokenResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AccessTokenResult listAccessToken(String resourceGroupName, String resourceName) { + AccessTokenResultInner inner = this.serviceClient().listAccessToken(resourceGroupName, resourceName); + if (inner != null) { + return new AccessTokenResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response validateMoveResourcesWithResponse( + String resourceGroupName, MoveResource moveResourceParameter, Context context) { + return this + .serviceClient() + .validateMoveResourcesWithResponse(resourceGroupName, moveResourceParameter, context); + } + + public void validateMoveResources(String resourceGroupName, MoveResource moveResourceParameter) { + this.serviceClient().validateMoveResources(resourceGroupName, moveResourceParameter); + } + + public void moveResources(String resourceGroupName, MoveResource moveResourceParameter) { + this.serviceClient().moveResources(resourceGroupName, moveResourceParameter); + } + + public void moveResources(String resourceGroupName, MoveResource moveResourceParameter, Context context) { + this.serviceClient().moveResources(resourceGroupName, moveResourceParameter, context); + } + + public SaasResource getById(String id) { + String resourceGroupName = Utils.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 resourceName = Utils.getValueFromIdByName(id, "resources"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 resourceName = Utils.getValueFromIdByName(id, "resources"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 resourceName = Utils.getValueFromIdByName(id, "resources"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resources'.", id))); + } + this.delete(resourceGroupName, resourceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 resourceName = Utils.getValueFromIdByName(id, "resources"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resources'.", id))); + } + this.delete(resourceGroupName, resourceName, context); + } + + private SaasSubscriptionLevelsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.saas.SaaSManager manager() { + return this.serviceManager; + } + + public SaasResourceImpl define(String name) { + return new SaasResourceImpl(name, this.manager()); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/Utils.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/Utils.java new file mode 100644 index 000000000000..97d6a065bf3c --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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 Utils { + 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.size() > 0 && 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, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + 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/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/package-info.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/package-info.java new file mode 100644 index 000000000000..69985c9a59ce --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/package-info.java @@ -0,0 +1,6 @@ +// 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 SaaSManagementClient. REST APIs for Azure Marketplace SaaS Offers. */ +package com.azure.resourcemanager.saas.implementation; diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/AccessTokenResult.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/AccessTokenResult.java new file mode 100644 index 000000000000..bab001beed1b --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/AccessTokenResult.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.resourcemanager.saas.fluent.models.AccessTokenResultInner; + +/** An immutable client-side representation of AccessTokenResult. */ +public interface AccessTokenResult { + /** + * Gets the publisherOfferBaseUri property: The Publisher Offer Base Uri. + * + * @return the publisherOfferBaseUri value. + */ + String publisherOfferBaseUri(); + + /** + * Gets the token property: The generated token. + * + * @return the token value. + */ + String token(); + + /** + * Gets the inner com.azure.resourcemanager.saas.fluent.models.AccessTokenResultInner object. + * + * @return the inner object. + */ + AccessTokenResultInner innerModel(); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/Applications.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/Applications.java new file mode 100644 index 000000000000..d03cc8ee53ee --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/Applications.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.saas.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Applications. */ +public interface Applications { + /** + * Gets all SaaS resources by subscription id and resource group name. + * + * @param resourceGroupName The name of the resource group. + * @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 all SaaS resources by subscription id and resource group name as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all SaaS resources by subscription id and resource group name. + * + * @param resourceGroupName The name of the resource group. + * @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 all SaaS resources by subscription id and resource group name as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/DeleteOptions.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/DeleteOptions.java new file mode 100644 index 000000000000..7dd737b7ab50 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/DeleteOptions.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** delete Options. */ +@Fluent +public final class DeleteOptions { + /* + * whether it is unsubscribeOnly + */ + @JsonProperty(value = "unsubscribeOnly") + private Boolean unsubscribeOnly; + + /* + * The reasonCode + */ + @JsonProperty(value = "reasonCode") + private Float reasonCode; + + /* + * the feedback + */ + @JsonProperty(value = "feedback") + private String feedback; + + /** Creates an instance of DeleteOptions class. */ + public DeleteOptions() { + } + + /** + * Get the unsubscribeOnly property: whether it is unsubscribeOnly. + * + * @return the unsubscribeOnly value. + */ + public Boolean unsubscribeOnly() { + return this.unsubscribeOnly; + } + + /** + * Set the unsubscribeOnly property: whether it is unsubscribeOnly. + * + * @param unsubscribeOnly the unsubscribeOnly value to set. + * @return the DeleteOptions object itself. + */ + public DeleteOptions withUnsubscribeOnly(Boolean unsubscribeOnly) { + this.unsubscribeOnly = unsubscribeOnly; + return this; + } + + /** + * Get the reasonCode property: The reasonCode. + * + * @return the reasonCode value. + */ + public Float reasonCode() { + return this.reasonCode; + } + + /** + * Set the reasonCode property: The reasonCode. + * + * @param reasonCode the reasonCode value to set. + * @return the DeleteOptions object itself. + */ + public DeleteOptions withReasonCode(Float reasonCode) { + this.reasonCode = reasonCode; + return this; + } + + /** + * Get the feedback property: the feedback. + * + * @return the feedback value. + */ + public String feedback() { + return this.feedback; + } + + /** + * Set the feedback property: the feedback. + * + * @param feedback the feedback value to set. + * @return the DeleteOptions object itself. + */ + public DeleteOptions withFeedback(String feedback) { + this.feedback = feedback; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/MoveResource.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/MoveResource.java new file mode 100644 index 000000000000..78d8a15d6a03 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/MoveResource.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Resource Move Options. */ +@Fluent +public final class MoveResource { + /* + * The target resource group uri for the move + */ + @JsonProperty(value = "targetResourceGroup") + private String targetResourceGroup; + + /* + * The resource uris to move + */ + @JsonProperty(value = "resources") + private List resources; + + /** Creates an instance of MoveResource class. */ + public MoveResource() { + } + + /** + * Get the targetResourceGroup property: The target resource group uri for the move. + * + * @return the targetResourceGroup value. + */ + public String targetResourceGroup() { + return this.targetResourceGroup; + } + + /** + * Set the targetResourceGroup property: The target resource group uri for the move. + * + * @param targetResourceGroup the targetResourceGroup value to set. + * @return the MoveResource object itself. + */ + public MoveResource withTargetResourceGroup(String targetResourceGroup) { + this.targetResourceGroup = targetResourceGroup; + return this; + } + + /** + * Get the resources property: The resource uris to move. + * + * @return the resources value. + */ + public List resources() { + return this.resources; + } + + /** + * Set the resources property: The resource uris to move. + * + * @param resources the resources value to set. + * @return the MoveResource object itself. + */ + public MoveResource withResources(List resources) { + this.resources = resources; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/Operations.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/Operations.java new file mode 100644 index 000000000000..25a9021b2116 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Gets all SaaS app operations. + * + * @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 all SaaS app operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets all SaaS app operations. + * + * @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 all SaaS app operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/PaymentChannelType.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/PaymentChannelType.java new file mode 100644 index 000000000000..e66b5218018f --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/PaymentChannelType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The Payment channel for the SaasSubscription. */ +public final class PaymentChannelType extends ExpandableStringEnum { + /** Static value SubscriptionDelegated for PaymentChannelType. */ + public static final PaymentChannelType SUBSCRIPTION_DELEGATED = fromString("SubscriptionDelegated"); + + /** Static value CustomerDelegated for PaymentChannelType. */ + public static final PaymentChannelType CUSTOMER_DELEGATED = fromString("CustomerDelegated"); + + /** + * Creates a new instance of PaymentChannelType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PaymentChannelType() { + } + + /** + * Creates or finds a PaymentChannelType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PaymentChannelType. + */ + @JsonCreator + public static PaymentChannelType fromString(String name) { + return fromString(name, PaymentChannelType.class); + } + + /** + * Gets known PaymentChannelType values. + * + * @return known PaymentChannelType values. + */ + public static Collection values() { + return values(PaymentChannelType.class); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/ResourceProviders.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/ResourceProviders.java new file mode 100644 index 000000000000..b2f475b6a516 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/ResourceProviders.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.saas.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Gets the ISV access token for a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 ISV access token for a SaaS resource along with {@link Response}. + */ + Response saasResourceListAccessTokenWithResponse(String resourceId, Context context); + + /** + * Gets the ISV access token for a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 ISV access token for a SaaS resource. + */ + AccessTokenResult saasResourceListAccessToken(String resourceId); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaS.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaS.java new file mode 100644 index 000000000000..175e01a8a7ae --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaS.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SaaS. */ +public interface SaaS { + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas 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 resourceId, DeleteOptions parameters); + + /** + * Deletes the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to delete saas operation. + * @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 resourceId, DeleteOptions parameters, Context context); + + /** + * Gets information about the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 information about the specified SaaS along with {@link Response}. + */ + Response getResourceWithResponse(String resourceId, Context context); + + /** + * Gets information about the specified SaaS. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @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 information about the specified SaaS. + */ + SaasResource getResource(String resourceId); + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas 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 saaS REST API resource definition. + */ + SaasResource updateResource(String resourceId, SaasResourceCreation parameters); + + /** + * Updates a SaaS resource. + * + * @param resourceId The Saas resource ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param parameters Parameters supplied to the update saas operation. + * @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 saaS REST API resource definition. + */ + SaasResource updateResource(String resourceId, SaasResourceCreation parameters, Context context); + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas 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 saaS REST API resource definition. + */ + SaasResource createResource(SaasResourceCreation parameters); + + /** + * Creates a SaaS resource. + * + * @param parameters Parameters supplied to the create saas operation. + * @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 saaS REST API resource definition. + */ + SaasResource createResource(SaasResourceCreation parameters, Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSOperations.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSOperations.java new file mode 100644 index 000000000000..cd5d1cfb6686 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSOperations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.util.Context; + +/** Resource collection API of SaaSOperations. */ +public interface SaaSOperations { + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id parameter. + * @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 information about the specified operation progress. + */ + SaasResource get(String operationId); + + /** + * Gets information about the specified operation progress. + * + * @param operationId the operation Id parameter. + * @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 information about the specified operation progress. + */ + SaasResource get(String operationId, Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasApp.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasApp.java new file mode 100644 index 000000000000..1c806ec63bb4 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasApp.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.resourcemanager.saas.fluent.models.SaasAppInner; +import java.util.Map; + +/** An immutable client-side representation of SaasApp. */ +public interface SaasApp { + /** + * Gets the id property: the resource Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the location property: the resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the name property: the resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: the resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: the resource properties. + * + * @return the properties value. + */ + SaasAppProperties properties(); + + /** + * Gets the tags property: the resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.saas.fluent.models.SaasAppInner object. + * + * @return the inner object. + */ + SaasAppInner innerModel(); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppOperation.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppOperation.java new file mode 100644 index 000000000000..e859490bb6b2 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppOperation.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.saas.models; + +import com.azure.resourcemanager.saas.fluent.models.SaasAppOperationInner; + +/** An immutable client-side representation of SaasAppOperation. */ +public interface SaasAppOperation { + /** + * Gets the name property: the operation name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: the operation display. + * + * @return the display value. + */ + SaasAppOperationDisplay display(); + + /** + * Gets the origin property: the operation origin. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the isDataAction property: whether the operation is a data action or not. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the inner com.azure.resourcemanager.saas.fluent.models.SaasAppOperationInner object. + * + * @return the inner object. + */ + SaasAppOperationInner innerModel(); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppOperationDisplay.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppOperationDisplay.java new file mode 100644 index 000000000000..ef2c2b5ee969 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppOperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Saas app operation display. */ +@Fluent +public final class SaasAppOperationDisplay { + /* + * Name of the provider for display purposes + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Name of the resource type for display purposes + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Name of the operation for display purposes + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the operation for display purposes + */ + @JsonProperty(value = "description") + private String description; + + /** Creates an instance of SaasAppOperationDisplay class. */ + public SaasAppOperationDisplay() { + } + + /** + * Get the provider property: Name of the provider for display purposes. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Name of the provider for display purposes. + * + * @param provider the provider value to set. + * @return the SaasAppOperationDisplay object itself. + */ + public SaasAppOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Name of the resource type for display purposes. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Name of the resource type for display purposes. + * + * @param resource the resource value to set. + * @return the SaasAppOperationDisplay object itself. + */ + public SaasAppOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Name of the operation for display purposes. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Name of the operation for display purposes. + * + * @param operation the operation value to set. + * @return the SaasAppOperationDisplay object itself. + */ + public SaasAppOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the operation for display purposes. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the operation for display purposes. + * + * @param description the description value to set. + * @return the SaasAppOperationDisplay object itself. + */ + public SaasAppOperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppOperationsResponseWithContinuation.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppOperationsResponseWithContinuation.java new file mode 100644 index 000000000000..0d3e382a15a6 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppOperationsResponseWithContinuation.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.saas.fluent.models.SaasAppOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** saas app operation response with continuation. */ +@Fluent +public final class SaasAppOperationsResponseWithContinuation { + /* + * the next link to query to get the remaining results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * the value of response. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of SaasAppOperationsResponseWithContinuation class. */ + public SaasAppOperationsResponseWithContinuation() { + } + + /** + * Get the nextLink property: the next link to query to get the remaining results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: the next link to query to get the remaining results. + * + * @param nextLink the nextLink value to set. + * @return the SaasAppOperationsResponseWithContinuation object itself. + */ + public SaasAppOperationsResponseWithContinuation withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: the value of response. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the value of response. + * + * @param value the value value to set. + * @return the SaasAppOperationsResponseWithContinuation object itself. + */ + public SaasAppOperationsResponseWithContinuation withValue(List value) { + this.value = value; + return this; + } + + /** + * 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/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppPlan.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppPlan.java new file mode 100644 index 000000000000..e43fd5515d4f --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppPlan.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Saas resource plan. */ +@Fluent +public final class SaasAppPlan { + /* + * the publisher id. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * the offer id. + */ + @JsonProperty(value = "product") + private String product; + + /* + * the plan id. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of SaasAppPlan class. */ + public SaasAppPlan() { + } + + /** + * Get the publisher property: the publisher id. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: the publisher id. + * + * @param publisher the publisher value to set. + * @return the SaasAppPlan object itself. + */ + public SaasAppPlan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: the offer id. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: the offer id. + * + * @param product the product value to set. + * @return the SaasAppPlan object itself. + */ + public SaasAppPlan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the name property: the plan id. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: the plan id. + * + * @param name the name value to set. + * @return the SaasAppPlan object itself. + */ + public SaasAppPlan withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppProperties.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppProperties.java new file mode 100644 index 000000000000..59579ccc4467 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Saas resource properties. */ +@Fluent +public final class SaasAppProperties { + /* + * the Saas resource status. + */ + @JsonProperty(value = "status") + private SaasAppStatus status; + + /* + * the resource plan details. + */ + @JsonProperty(value = "saasAppPlan") + private SaasAppPlan saasAppPlan; + + /** Creates an instance of SaasAppProperties class. */ + public SaasAppProperties() { + } + + /** + * Get the status property: the Saas resource status. + * + * @return the status value. + */ + public SaasAppStatus status() { + return this.status; + } + + /** + * Set the status property: the Saas resource status. + * + * @param status the status value to set. + * @return the SaasAppProperties object itself. + */ + public SaasAppProperties withStatus(SaasAppStatus status) { + this.status = status; + return this; + } + + /** + * Get the saasAppPlan property: the resource plan details. + * + * @return the saasAppPlan value. + */ + public SaasAppPlan saasAppPlan() { + return this.saasAppPlan; + } + + /** + * Set the saasAppPlan property: the resource plan details. + * + * @param saasAppPlan the saasAppPlan value to set. + * @return the SaasAppProperties object itself. + */ + public SaasAppProperties withSaasAppPlan(SaasAppPlan saasAppPlan) { + this.saasAppPlan = saasAppPlan; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (saasAppPlan() != null) { + saasAppPlan().validate(); + } + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppResponseWithContinuation.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppResponseWithContinuation.java new file mode 100644 index 000000000000..415b29d2fbb5 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppResponseWithContinuation.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.saas.fluent.models.SaasAppInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** saas app response with continuation. */ +@Fluent +public final class SaasAppResponseWithContinuation { + /* + * the next link to query to get the remaining results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * the value of response. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of SaasAppResponseWithContinuation class. */ + public SaasAppResponseWithContinuation() { + } + + /** + * Get the nextLink property: the next link to query to get the remaining results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: the next link to query to get the remaining results. + * + * @param nextLink the nextLink value to set. + * @return the SaasAppResponseWithContinuation object itself. + */ + public SaasAppResponseWithContinuation withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: the value of response. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the value of response. + * + * @param value the value value to set. + * @return the SaasAppResponseWithContinuation object itself. + */ + public SaasAppResponseWithContinuation withValue(List value) { + this.value = value; + return this; + } + + /** + * 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/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppStatus.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppStatus.java new file mode 100644 index 000000000000..c750ce6a020e --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** the Saas resource status. */ +public final class SaasAppStatus extends ExpandableStringEnum { + /** Static value Pending for SaasAppStatus. */ + public static final SaasAppStatus PENDING = fromString("Pending"); + + /** Static value Subscribed for SaasAppStatus. */ + public static final SaasAppStatus SUBSCRIBED = fromString("Subscribed"); + + /** Static value Unsubscribed for SaasAppStatus. */ + public static final SaasAppStatus UNSUBSCRIBED = fromString("Unsubscribed"); + + /** Static value Suspended for SaasAppStatus. */ + public static final SaasAppStatus SUSPENDED = fromString("Suspended"); + + /** Static value Deactivated for SaasAppStatus. */ + public static final SaasAppStatus DEACTIVATED = fromString("Deactivated"); + + /** + * Creates a new instance of SaasAppStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SaasAppStatus() { + } + + /** + * Creates or finds a SaasAppStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SaasAppStatus. + */ + @JsonCreator + public static SaasAppStatus fromString(String name) { + return fromString(name, SaasAppStatus.class); + } + + /** + * Gets known SaasAppStatus values. + * + * @return known SaasAppStatus values. + */ + public static Collection values() { + return values(SaasAppStatus.class); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasCreationProperties.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasCreationProperties.java new file mode 100644 index 000000000000..320f7f03733f --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasCreationProperties.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** properties for creation saas. */ +@Fluent +public class SaasCreationProperties { + /* + * The offer id. + */ + @JsonProperty(value = "offerId") + private String offerId; + + /* + * The publisher id. + */ + @JsonProperty(value = "publisherId") + private String publisherId; + + /* + * The seat count. + */ + @JsonProperty(value = "quantity") + private Float quantity; + + /* + * The plan id. + */ + @JsonProperty(value = "skuId") + private String skuId; + + /* + * The Payment channel for the SaasSubscription. + */ + @JsonProperty(value = "paymentChannelType") + private PaymentChannelType paymentChannelType; + + /* + * The metadata about the SaaS subscription such as the AzureSubscriptionId and ResourceUri. + */ + @JsonProperty(value = "paymentChannelMetadata") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map paymentChannelMetadata; + + /* + * The SaaS resource name. + */ + @JsonProperty(value = "saasResourceName") + private String saasResourceName; + + /* + * The current Term id. + */ + @JsonProperty(value = "termId") + private String termId; + + /* + * Whether the SaaS subscription will auto renew upon term end. + */ + @JsonProperty(value = "autoRenew") + private Boolean autoRenew; + + /* + * The environment in the publisher side for this resource. + */ + @JsonProperty(value = "publisherTestEnvironment") + private String publisherTestEnvironment; + + /* + * The saas subscription id used for tenant to subscription level migration request. + */ + @JsonProperty(value = "saasSubscriptionId") + private String saasSubscriptionId; + + /* + * The saas session id used for dev service migration request. + */ + @JsonProperty(value = "saasSessionId") + private String saasSessionId; + + /** Creates an instance of SaasCreationProperties class. */ + public SaasCreationProperties() { + } + + /** + * Get the offerId property: The offer id. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Set the offerId property: The offer id. + * + * @param offerId the offerId value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withOfferId(String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Get the publisherId property: The publisher id. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Set the publisherId property: The publisher id. + * + * @param publisherId the publisherId value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withPublisherId(String publisherId) { + this.publisherId = publisherId; + return this; + } + + /** + * Get the quantity property: The seat count. + * + * @return the quantity value. + */ + public Float quantity() { + return this.quantity; + } + + /** + * Set the quantity property: The seat count. + * + * @param quantity the quantity value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withQuantity(Float quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the skuId property: The plan id. + * + * @return the skuId value. + */ + public String skuId() { + return this.skuId; + } + + /** + * Set the skuId property: The plan id. + * + * @param skuId the skuId value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get the paymentChannelType property: The Payment channel for the SaasSubscription. + * + * @return the paymentChannelType value. + */ + public PaymentChannelType paymentChannelType() { + return this.paymentChannelType; + } + + /** + * Set the paymentChannelType property: The Payment channel for the SaasSubscription. + * + * @param paymentChannelType the paymentChannelType value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withPaymentChannelType(PaymentChannelType paymentChannelType) { + this.paymentChannelType = paymentChannelType; + return this; + } + + /** + * Get the paymentChannelMetadata property: The metadata about the SaaS subscription such as the AzureSubscriptionId + * and ResourceUri. + * + * @return the paymentChannelMetadata value. + */ + public Map paymentChannelMetadata() { + return this.paymentChannelMetadata; + } + + /** + * Set the paymentChannelMetadata property: The metadata about the SaaS subscription such as the AzureSubscriptionId + * and ResourceUri. + * + * @param paymentChannelMetadata the paymentChannelMetadata value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withPaymentChannelMetadata(Map paymentChannelMetadata) { + this.paymentChannelMetadata = paymentChannelMetadata; + return this; + } + + /** + * Get the saasResourceName property: The SaaS resource name. + * + * @return the saasResourceName value. + */ + public String saasResourceName() { + return this.saasResourceName; + } + + /** + * Set the saasResourceName property: The SaaS resource name. + * + * @param saasResourceName the saasResourceName value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withSaasResourceName(String saasResourceName) { + this.saasResourceName = saasResourceName; + return this; + } + + /** + * Get the termId property: The current Term id. + * + * @return the termId value. + */ + public String termId() { + return this.termId; + } + + /** + * Set the termId property: The current Term id. + * + * @param termId the termId value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withTermId(String termId) { + this.termId = termId; + return this; + } + + /** + * Get the autoRenew property: Whether the SaaS subscription will auto renew upon term end. + * + * @return the autoRenew value. + */ + public Boolean autoRenew() { + return this.autoRenew; + } + + /** + * Set the autoRenew property: Whether the SaaS subscription will auto renew upon term end. + * + * @param autoRenew the autoRenew value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withAutoRenew(Boolean autoRenew) { + this.autoRenew = autoRenew; + return this; + } + + /** + * Get the publisherTestEnvironment property: The environment in the publisher side for this resource. + * + * @return the publisherTestEnvironment value. + */ + public String publisherTestEnvironment() { + return this.publisherTestEnvironment; + } + + /** + * Set the publisherTestEnvironment property: The environment in the publisher side for this resource. + * + * @param publisherTestEnvironment the publisherTestEnvironment value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withPublisherTestEnvironment(String publisherTestEnvironment) { + this.publisherTestEnvironment = publisherTestEnvironment; + return this; + } + + /** + * Get the saasSubscriptionId property: The saas subscription id used for tenant to subscription level migration + * request. + * + * @return the saasSubscriptionId value. + */ + public String saasSubscriptionId() { + return this.saasSubscriptionId; + } + + /** + * Set the saasSubscriptionId property: The saas subscription id used for tenant to subscription level migration + * request. + * + * @param saasSubscriptionId the saasSubscriptionId value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withSaasSubscriptionId(String saasSubscriptionId) { + this.saasSubscriptionId = saasSubscriptionId; + return this; + } + + /** + * Get the saasSessionId property: The saas session id used for dev service migration request. + * + * @return the saasSessionId value. + */ + public String saasSessionId() { + return this.saasSessionId; + } + + /** + * Set the saasSessionId property: The saas session id used for dev service migration request. + * + * @param saasSessionId the saasSessionId value to set. + * @return the SaasCreationProperties object itself. + */ + public SaasCreationProperties withSaasSessionId(String saasSessionId) { + this.saasSessionId = saasSessionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasProperties.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasProperties.java new file mode 100644 index 000000000000..10021deb2532 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasProperties.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** saas resource properties. */ +@Fluent +public class SaasProperties { + /* + * The SaaS Subscription Status. + */ + @JsonProperty(value = "status") + private SaasResourceStatus status; + + /* + * The current Term object. + */ + @JsonProperty(value = "term") + private SaasPropertiesTerm term; + + /* + * Whether the current term is a Free Trial term + */ + @JsonProperty(value = "isFreeTrial") + private Boolean isFreeTrial; + + /* + * The created date of this resource. + */ + @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY) + private String created; + + /* + * The last modifier date if this resource. + */ + @JsonProperty(value = "lastModified") + private String lastModified; + + /** Creates an instance of SaasProperties class. */ + public SaasProperties() { + } + + /** + * Get the status property: The SaaS Subscription Status. + * + * @return the status value. + */ + public SaasResourceStatus status() { + return this.status; + } + + /** + * Set the status property: The SaaS Subscription Status. + * + * @param status the status value to set. + * @return the SaasProperties object itself. + */ + public SaasProperties withStatus(SaasResourceStatus status) { + this.status = status; + return this; + } + + /** + * Get the term property: The current Term object. + * + * @return the term value. + */ + public SaasPropertiesTerm term() { + return this.term; + } + + /** + * Set the term property: The current Term object. + * + * @param term the term value to set. + * @return the SaasProperties object itself. + */ + public SaasProperties withTerm(SaasPropertiesTerm term) { + this.term = term; + return this; + } + + /** + * Get the isFreeTrial property: Whether the current term is a Free Trial term. + * + * @return the isFreeTrial value. + */ + public Boolean isFreeTrial() { + return this.isFreeTrial; + } + + /** + * Set the isFreeTrial property: Whether the current term is a Free Trial term. + * + * @param isFreeTrial the isFreeTrial value to set. + * @return the SaasProperties object itself. + */ + public SaasProperties withIsFreeTrial(Boolean isFreeTrial) { + this.isFreeTrial = isFreeTrial; + return this; + } + + /** + * Get the created property: The created date of this resource. + * + * @return the created value. + */ + public String created() { + return this.created; + } + + /** + * Get the lastModified property: The last modifier date if this resource. + * + * @return the lastModified value. + */ + public String lastModified() { + return this.lastModified; + } + + /** + * Set the lastModified property: The last modifier date if this resource. + * + * @param lastModified the lastModified value to set. + * @return the SaasProperties object itself. + */ + public SaasProperties withLastModified(String lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (term() != null) { + term().validate(); + } + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasPropertiesTerm.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasPropertiesTerm.java new file mode 100644 index 000000000000..841ba97ef969 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasPropertiesTerm.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The current Term object. */ +@Fluent +public final class SaasPropertiesTerm { + /* + * The unit indicating Monthly / Yearly + */ + @JsonProperty(value = "termUnit") + private String termUnit; + + /* + * The start date of the current term + */ + @JsonProperty(value = "startDate") + private String startDate; + + /* + * The end date of the current term + */ + @JsonProperty(value = "endDate") + private String endDate; + + /** Creates an instance of SaasPropertiesTerm class. */ + public SaasPropertiesTerm() { + } + + /** + * Get the termUnit property: The unit indicating Monthly / Yearly. + * + * @return the termUnit value. + */ + public String termUnit() { + return this.termUnit; + } + + /** + * Set the termUnit property: The unit indicating Monthly / Yearly. + * + * @param termUnit the termUnit value to set. + * @return the SaasPropertiesTerm object itself. + */ + public SaasPropertiesTerm withTermUnit(String termUnit) { + this.termUnit = termUnit; + return this; + } + + /** + * Get the startDate property: The start date of the current term. + * + * @return the startDate value. + */ + public String startDate() { + return this.startDate; + } + + /** + * Set the startDate property: The start date of the current term. + * + * @param startDate the startDate value to set. + * @return the SaasPropertiesTerm object itself. + */ + public SaasPropertiesTerm withStartDate(String startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the endDate property: The end date of the current term. + * + * @return the endDate value. + */ + public String endDate() { + return this.endDate; + } + + /** + * Set the endDate property: The end date of the current term. + * + * @param endDate the endDate value to set. + * @return the SaasPropertiesTerm object itself. + */ + public SaasPropertiesTerm withEndDate(String endDate) { + this.endDate = endDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResource.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResource.java new file mode 100644 index 000000000000..e003fda32f9f --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResource.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import java.util.Map; + +/** An immutable client-side representation of SaasResource. */ +public interface SaasResource { + /** + * 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 properties property: saas properties. + * + * @return the properties value. + */ + SaasResourceProperties properties(); + + /** + * Gets the tags property: the resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.saas.fluent.models.SaasResourceInner object. + * + * @return the inner object. + */ + SaasResourceInner innerModel(); + + /** The entirety of the SaasResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + /** The SaasResource definition stages. */ + interface DefinitionStages { + /** The first stage of the SaasResource definition. */ + interface Blank extends WithResourceGroup { + } + /** The stage of the SaasResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the SaasResource 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.WithLocation, + DefinitionStages.WithTags, + DefinitionStages.WithName, + DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + SaasResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SaasResource create(Context context); + } + /** The stage of the SaasResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location Resource location. Only value allowed for SaaS is 'global'. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location Resource location. Only value allowed for SaaS is 'global'. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the SaasResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: the resource tags.. + * + * @param tags the resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the SaasResource definition allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: The resource name. + * + * @param name The resource name. + * @return the next definition stage. + */ + WithCreate withName(String name); + } + /** The stage of the SaasResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the SaaS resource that are relevant for creation.. + * + * @param properties Properties of the SaaS resource that are relevant for creation. + * @return the next definition stage. + */ + WithCreate withProperties(SaasCreationProperties properties); + } + } + /** + * Begins update for the SaasResource resource. + * + * @return the stage of resource update. + */ + SaasResource.Update update(); + + /** The template for SaasResource update. */ + interface Update + extends UpdateStages.WithLocation, UpdateStages.WithTags, UpdateStages.WithName, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SaasResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SaasResource apply(Context context); + } + /** The SaasResource update stages. */ + interface UpdateStages { + /** The stage of the SaasResource update allowing to specify location. */ + interface WithLocation { + /** + * Specifies the location property: Resource location. Only value allowed for SaaS is 'global'. + * + * @param location Resource location. Only value allowed for SaaS is 'global'. + * @return the next definition stage. + */ + Update withLocation(String location); + } + /** The stage of the SaasResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: the resource tags.. + * + * @param tags the resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the SaasResource update allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: The resource name. + * + * @param name The resource name. + * @return the next definition stage. + */ + Update withName(String name); + } + /** The stage of the SaasResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the SaaS resource that are relevant for creation.. + * + * @param properties Properties of the SaaS resource that are relevant for creation. + * @return the next definition stage. + */ + Update withProperties(SaasCreationProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SaasResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SaasResource refresh(Context context); + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param parameters Parameters supplied to unsubscribe saas 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 updateToUnsubscribed(DeleteOptions parameters); + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param parameters Parameters supplied to unsubscribe saas operation. + * @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 updateToUnsubscribed(DeleteOptions parameters, Context context); + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @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 ISV access token for a specified Subscription Level SaaS along with {@link Response}. + */ + Response listAccessTokenWithResponse(Context context); + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @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 ISV access token for a specified Subscription Level SaaS. + */ + AccessTokenResult listAccessToken(); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceCreation.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceCreation.java new file mode 100644 index 000000000000..e37b5df9e4e3 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceCreation.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** SaaS REST API resource definition for creation. */ +@Fluent +public final class SaasResourceCreation { + /* + * The resource uri + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The resource name + */ + @JsonProperty(value = "name") + private String name; + + /* + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * the resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Resource location. Only value allowed for SaaS is 'global' + */ + @JsonProperty(value = "location") + private String location; + + /* + * Properties of the SaaS resource that are relevant for creation. + */ + @JsonProperty(value = "properties") + private SaasCreationProperties properties; + + /** Creates an instance of SaasResourceCreation class. */ + public SaasResourceCreation() { + } + + /** + * Get the id property: The resource uri. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The resource name. + * + * @param name the name value to set. + * @return the SaasResourceCreation object itself. + */ + public SaasResourceCreation withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the tags property: the resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: the resource tags. + * + * @param tags the tags value to set. + * @return the SaasResourceCreation object itself. + */ + public SaasResourceCreation withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location property: Resource location. Only value allowed for SaaS is 'global'. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Resource location. Only value allowed for SaaS is 'global'. + * + * @param location the location value to set. + * @return the SaasResourceCreation object itself. + */ + public SaasResourceCreation withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the properties property: Properties of the SaaS resource that are relevant for creation. + * + * @return the properties value. + */ + public SaasCreationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the SaaS resource that are relevant for creation. + * + * @param properties the properties value to set. + * @return the SaasResourceCreation object itself. + */ + public SaasResourceCreation withProperties(SaasCreationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceProperties.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceProperties.java new file mode 100644 index 000000000000..b95795d1604c --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceProperties.java @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** saas properties. */ +@Fluent +public final class SaasResourceProperties extends SaasProperties { + /* + * The offer id. + */ + @JsonProperty(value = "offerId") + private String offerId; + + /* + * The publisher id. + */ + @JsonProperty(value = "publisherId") + private String publisherId; + + /* + * The seat count. + */ + @JsonProperty(value = "quantity") + private Float quantity; + + /* + * The plan id. + */ + @JsonProperty(value = "skuId") + private String skuId; + + /* + * The Payment channel for the SaasSubscription. + */ + @JsonProperty(value = "paymentChannelType") + private PaymentChannelType paymentChannelType; + + /* + * The metadata about the SaaS subscription such as the AzureSubscriptionId and ResourceUri. + */ + @JsonProperty(value = "paymentChannelMetadata") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map paymentChannelMetadata; + + /* + * The SaaS resource name. + */ + @JsonProperty(value = "saasResourceName") + private String saasResourceName; + + /* + * The current Term id. + */ + @JsonProperty(value = "termId") + private String termId; + + /* + * Whether the SaaS subscription will auto renew upon term end. + */ + @JsonProperty(value = "autoRenew") + private Boolean autoRenew; + + /* + * The environment in the publisher side for this resource. + */ + @JsonProperty(value = "publisherTestEnvironment") + private String publisherTestEnvironment; + + /* + * The saas subscription id used for tenant to subscription level migration request. + */ + @JsonProperty(value = "saasSubscriptionId") + private String saasSubscriptionId; + + /* + * The saas session id used for dev service migration request. + */ + @JsonProperty(value = "saasSessionId") + private String saasSessionId; + + /** Creates an instance of SaasResourceProperties class. */ + public SaasResourceProperties() { + } + + /** + * Get the offerId property: The offer id. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Set the offerId property: The offer id. + * + * @param offerId the offerId value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withOfferId(String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Get the publisherId property: The publisher id. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Set the publisherId property: The publisher id. + * + * @param publisherId the publisherId value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withPublisherId(String publisherId) { + this.publisherId = publisherId; + return this; + } + + /** + * Get the quantity property: The seat count. + * + * @return the quantity value. + */ + public Float quantity() { + return this.quantity; + } + + /** + * Set the quantity property: The seat count. + * + * @param quantity the quantity value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withQuantity(Float quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the skuId property: The plan id. + * + * @return the skuId value. + */ + public String skuId() { + return this.skuId; + } + + /** + * Set the skuId property: The plan id. + * + * @param skuId the skuId value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get the paymentChannelType property: The Payment channel for the SaasSubscription. + * + * @return the paymentChannelType value. + */ + public PaymentChannelType paymentChannelType() { + return this.paymentChannelType; + } + + /** + * Set the paymentChannelType property: The Payment channel for the SaasSubscription. + * + * @param paymentChannelType the paymentChannelType value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withPaymentChannelType(PaymentChannelType paymentChannelType) { + this.paymentChannelType = paymentChannelType; + return this; + } + + /** + * Get the paymentChannelMetadata property: The metadata about the SaaS subscription such as the AzureSubscriptionId + * and ResourceUri. + * + * @return the paymentChannelMetadata value. + */ + public Map paymentChannelMetadata() { + return this.paymentChannelMetadata; + } + + /** + * Set the paymentChannelMetadata property: The metadata about the SaaS subscription such as the AzureSubscriptionId + * and ResourceUri. + * + * @param paymentChannelMetadata the paymentChannelMetadata value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withPaymentChannelMetadata(Map paymentChannelMetadata) { + this.paymentChannelMetadata = paymentChannelMetadata; + return this; + } + + /** + * Get the saasResourceName property: The SaaS resource name. + * + * @return the saasResourceName value. + */ + public String saasResourceName() { + return this.saasResourceName; + } + + /** + * Set the saasResourceName property: The SaaS resource name. + * + * @param saasResourceName the saasResourceName value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withSaasResourceName(String saasResourceName) { + this.saasResourceName = saasResourceName; + return this; + } + + /** + * Get the termId property: The current Term id. + * + * @return the termId value. + */ + public String termId() { + return this.termId; + } + + /** + * Set the termId property: The current Term id. + * + * @param termId the termId value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withTermId(String termId) { + this.termId = termId; + return this; + } + + /** + * Get the autoRenew property: Whether the SaaS subscription will auto renew upon term end. + * + * @return the autoRenew value. + */ + public Boolean autoRenew() { + return this.autoRenew; + } + + /** + * Set the autoRenew property: Whether the SaaS subscription will auto renew upon term end. + * + * @param autoRenew the autoRenew value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withAutoRenew(Boolean autoRenew) { + this.autoRenew = autoRenew; + return this; + } + + /** + * Get the publisherTestEnvironment property: The environment in the publisher side for this resource. + * + * @return the publisherTestEnvironment value. + */ + public String publisherTestEnvironment() { + return this.publisherTestEnvironment; + } + + /** + * Set the publisherTestEnvironment property: The environment in the publisher side for this resource. + * + * @param publisherTestEnvironment the publisherTestEnvironment value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withPublisherTestEnvironment(String publisherTestEnvironment) { + this.publisherTestEnvironment = publisherTestEnvironment; + return this; + } + + /** + * Get the saasSubscriptionId property: The saas subscription id used for tenant to subscription level migration + * request. + * + * @return the saasSubscriptionId value. + */ + public String saasSubscriptionId() { + return this.saasSubscriptionId; + } + + /** + * Set the saasSubscriptionId property: The saas subscription id used for tenant to subscription level migration + * request. + * + * @param saasSubscriptionId the saasSubscriptionId value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withSaasSubscriptionId(String saasSubscriptionId) { + this.saasSubscriptionId = saasSubscriptionId; + return this; + } + + /** + * Get the saasSessionId property: The saas session id used for dev service migration request. + * + * @return the saasSessionId value. + */ + public String saasSessionId() { + return this.saasSessionId; + } + + /** + * Set the saasSessionId property: The saas session id used for dev service migration request. + * + * @param saasSessionId the saasSessionId value to set. + * @return the SaasResourceProperties object itself. + */ + public SaasResourceProperties withSaasSessionId(String saasSessionId) { + this.saasSessionId = saasSessionId; + return this; + } + + /** {@inheritDoc} */ + @Override + public SaasResourceProperties withStatus(SaasResourceStatus status) { + super.withStatus(status); + return this; + } + + /** {@inheritDoc} */ + @Override + public SaasResourceProperties withTerm(SaasPropertiesTerm term) { + super.withTerm(term); + return this; + } + + /** {@inheritDoc} */ + @Override + public SaasResourceProperties withIsFreeTrial(Boolean isFreeTrial) { + super.withIsFreeTrial(isFreeTrial); + return this; + } + + /** {@inheritDoc} */ + @Override + public SaasResourceProperties withLastModified(String lastModified) { + super.withLastModified(lastModified); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceResponseWithContinuation.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceResponseWithContinuation.java new file mode 100644 index 000000000000..f27bee7b987f --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceResponseWithContinuation.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** saas resources response with continuation. */ +@Fluent +public final class SaasResourceResponseWithContinuation { + /* + * the next link to query to get the remaining results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * the value of response. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of SaasResourceResponseWithContinuation class. */ + public SaasResourceResponseWithContinuation() { + } + + /** + * Get the nextLink property: the next link to query to get the remaining results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: the next link to query to get the remaining results. + * + * @param nextLink the nextLink value to set. + * @return the SaasResourceResponseWithContinuation object itself. + */ + public SaasResourceResponseWithContinuation withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: the value of response. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the value of response. + * + * @param value the value value to set. + * @return the SaasResourceResponseWithContinuation object itself. + */ + public SaasResourceResponseWithContinuation withValue(List value) { + this.value = value; + return this; + } + + /** + * 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/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceStatus.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceStatus.java new file mode 100644 index 000000000000..e73d238928c7 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The SaaS Subscription Status. */ +public final class SaasResourceStatus extends ExpandableStringEnum { + /** Static value NotStarted for SaasResourceStatus. */ + public static final SaasResourceStatus NOT_STARTED = fromString("NotStarted"); + + /** Static value PendingFulfillmentStart for SaasResourceStatus. */ + public static final SaasResourceStatus PENDING_FULFILLMENT_START = fromString("PendingFulfillmentStart"); + + /** Static value Subscribed for SaasResourceStatus. */ + public static final SaasResourceStatus SUBSCRIBED = fromString("Subscribed"); + + /** Static value Unsubscribed for SaasResourceStatus. */ + public static final SaasResourceStatus UNSUBSCRIBED = fromString("Unsubscribed"); + + /** Static value Suspended for SaasResourceStatus. */ + public static final SaasResourceStatus SUSPENDED = fromString("Suspended"); + + /** + * Creates a new instance of SaasResourceStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SaasResourceStatus() { + } + + /** + * Creates or finds a SaasResourceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SaasResourceStatus. + */ + @JsonCreator + public static SaasResourceStatus fromString(String name) { + return fromString(name, SaasResourceStatus.class); + } + + /** + * Gets known SaasResourceStatus values. + * + * @return known SaasResourceStatus values. + */ + public static Collection values() { + return values(SaasResourceStatus.class); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResources.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResources.java new file mode 100644 index 000000000000..0ca91b5cc17a --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResources.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of SaasResources. */ +public interface SaasResources { + /** + * Get All Resources. + * + * @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 all Resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get All Resources. + * + * @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 all Resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevels.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevels.java new file mode 100644 index 000000000000..ddc36b443483 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevels.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.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 SaasSubscriptionLevels. */ +public interface SaasSubscriptionLevels { + /** + * Gets information about all the Subscription Level SaaS in a certain Azure subscription. + * + * @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 information about all the Subscription Level SaaS in a certain Azure subscription as paginated response + * with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets information about all the Subscription Level SaaS in a certain Azure subscription. + * + * @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 information about all the Subscription Level SaaS in a certain Azure subscription as paginated response + * with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets information about all the Subscription Level SaaS in a certain resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 information about all the Subscription Level SaaS in a certain resource group as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets information about all the Subscription Level SaaS in a certain resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 information about all the Subscription Level SaaS in a certain resource group as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 information about the specified Subscription Level SaaS along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 information about the specified Subscription Level SaaS. + */ + SaasResource getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName); + + /** + * Deletes the specified SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 resourceName, Context context); + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas 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 updateToUnsubscribed(String resourceGroupName, String resourceName, DeleteOptions parameters); + + /** + * Unsubscribe from a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the resource. + * @param parameters Parameters supplied to unsubscribe saas operation. + * @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 updateToUnsubscribed(String resourceGroupName, String resourceName, DeleteOptions parameters, Context context); + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 ISV access token for a specified Subscription Level SaaS along with {@link Response}. + */ + Response listAccessTokenWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Gets the ISV access token for a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the 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 ISV access token for a specified Subscription Level SaaS. + */ + AccessTokenResult listAccessToken(String resourceGroupName, String resourceName); + + /** + * Validate whether a specified Subscription Level SaaS can be moved. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 Response}. + */ + Response validateMoveResourcesWithResponse( + String resourceGroupName, MoveResource moveResourceParameter, Context context); + + /** + * Validate whether a specified Subscription Level SaaS can be moved. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 validateMoveResources(String resourceGroupName, MoveResource moveResourceParameter); + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 moveResources(String resourceGroupName, MoveResource moveResourceParameter); + + /** + * Move a specified Subscription Level SaaS. + * + * @param resourceGroupName The name of the resource group. + * @param moveResourceParameter Object that represents the resources to move. + * @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 moveResources(String resourceGroupName, MoveResource moveResourceParameter, Context context); + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @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 information about the specified Subscription Level SaaS along with {@link Response}. + */ + SaasResource getById(String id); + + /** + * Gets information about the specified Subscription Level SaaS. + * + * @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 information about the specified Subscription Level SaaS along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified SaaS. + * + * @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); + + /** + * Deletes the specified SaaS. + * + * @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 SaasResource resource. + * + * @param name resource name. + * @return the first stage of the new SaasResource definition. + */ + SaasResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/package-info.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/package-info.java new file mode 100644 index 000000000000..a7d7ae46d811 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/package-info.java @@ -0,0 +1,6 @@ +// 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 SaaSManagementClient. REST APIs for Azure Marketplace SaaS Offers. */ +package com.azure.resourcemanager.saas.models; diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/package-info.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/package-info.java new file mode 100644 index 000000000000..6cbd16ecdc37 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/package-info.java @@ -0,0 +1,6 @@ +// 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 SaaSManagementClient. REST APIs for Azure Marketplace SaaS Offers. */ +package com.azure.resourcemanager.saas; diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/module-info.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/module-info.java new file mode 100644 index 000000000000..10dc5e8a3bb6 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.saas { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.saas; + exports com.azure.resourcemanager.saas.fluent; + exports com.azure.resourcemanager.saas.fluent.models; + exports com.azure.resourcemanager.saas.models; + + opens com.azure.resourcemanager.saas.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.saas.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/ApplicationsListByResourceGroupSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/ApplicationsListByResourceGroupSamples.java new file mode 100644 index 000000000000..2ebd0c669446 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/ApplicationsListByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +/** Samples for Applications ListByResourceGroup. */ +public final class ApplicationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV1/SaaSGetApplications.json + */ + /** + * Sample code: Get saas application. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSaasApplication(com.azure.resourcemanager.saas.SaaSManager manager) { + manager.applications().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/OperationsListSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/OperationsListSamples.java new file mode 100644 index 000000000000..adf9e070036b --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/OperationsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV1/SaaSGetOperations.json + */ + /** + * Sample code: Get saas operations. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSaasOperations(com.azure.resourcemanager.saas.SaaSManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/ResourceProviderSaasResourceListAccessTokenSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/ResourceProviderSaasResourceListAccessTokenSamples.java new file mode 100644 index 000000000000..9cf87757f303 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/ResourceProviderSaasResourceListAccessTokenSamples.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.saas.generated; + +/** Samples for ResourceProvider SaasResourceListAccessToken. */ +public final class ResourceProviderSaasResourceListAccessTokenSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/ListAccessTokenPost.json + */ + /** + * Sample code: generated SaaS resource token. + * + * @param manager Entry point to SaaSManager. + */ + public static void generatedSaaSResourceToken(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .resourceProviders() + .saasResourceListAccessTokenWithResponse( + "c825645b-e31b-9cf4-1cee-2aba9e58bc7c", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSCreateResourceSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSCreateResourceSamples.java new file mode 100644 index 000000000000..64ed2ef92ff2 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSCreateResourceSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +import com.azure.resourcemanager.saas.models.PaymentChannelType; +import com.azure.resourcemanager.saas.models.SaasCreationProperties; +import com.azure.resourcemanager.saas.models.SaasResourceCreation; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SaaS CreateResource. */ +public final class SaaSCreateResourceSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/SaasPut.json + */ + /** + * Sample code: Create SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void createSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saaS() + .createResource( + new SaasResourceCreation() + .withProperties( + new SaasCreationProperties() + .withOfferId("microsofthealthcarebot") + .withPublisherId("microsoft-hcb") + .withSkuId("free") + .withPaymentChannelType(PaymentChannelType.SUBSCRIPTION_DELEGATED) + .withPaymentChannelMetadata( + mapOf("AzureSubscriptionId", "155af98a-3205-47e7-883b-a2ab9db9f88d")) + .withSaasResourceName("testRunnerFromArm") + .withTermId("hjdtn7tfnxcy")), + com.azure.core.util.Context.NONE); + } + + @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/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSDeleteSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSDeleteSamples.java new file mode 100644 index 000000000000..beae3cfaa74d --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +import com.azure.resourcemanager.saas.models.DeleteOptions; + +/** Samples for SaaS Delete. */ +public final class SaaSDeleteSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/SaasDelete.json + */ + /** + * Sample code: Delete SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void deleteSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saaS() + .delete( + "115c3523-1fae-757f-af86-7b27cfd29805", + new DeleteOptions().withUnsubscribeOnly(true).withReasonCode(0.0F), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSGetResourceSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSGetResourceSamples.java new file mode 100644 index 000000000000..85acbf029f6d --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSGetResourceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +/** Samples for SaaS GetResource. */ +public final class SaaSGetResourceSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/SaasGet.json + */ + /** + * Sample code: Get SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saaS() + .getResourceWithResponse("115c3523-1fae-757f-af86-7b27cfd29805", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSOperationGetSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSOperationGetSamples.java new file mode 100644 index 000000000000..10e7868133e7 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSOperationGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +/** Samples for SaaSOperation Get. */ +public final class SaaSOperationGetSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/OperationResults/Get.json + */ + /** + * Sample code: Get operation status. + * + * @param manager Entry point to SaaSManager. + */ + public static void getOperationStatus(com.azure.resourcemanager.saas.SaaSManager manager) { + manager.saaSOperations().get("5f35cb4c-8065-45b3-9116-5ba335462e95", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSUpdateResourceSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSUpdateResourceSamples.java new file mode 100644 index 000000000000..64bfa3b00334 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSUpdateResourceSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +import com.azure.resourcemanager.saas.models.SaasCreationProperties; +import com.azure.resourcemanager.saas.models.SaasResourceCreation; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SaaS UpdateResource. */ +public final class SaaSUpdateResourceSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/SaasPatch.json + */ + /** + * Sample code: Update SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void updateSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saaS() + .updateResource( + "115c3523-1fae-757f-af86-7b27cfd29805", + new SaasResourceCreation() + .withTags(mapOf()) + .withProperties(new SaasCreationProperties().withSkuId("premium")), + com.azure.core.util.Context.NONE); + } + + @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/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasResourcesListSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasResourcesListSamples.java new file mode 100644 index 000000000000..c684b173a227 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasResourcesListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +/** Samples for SaasResources List. */ +public final class SaasResourcesListSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasV2/SaaSGetAllResources.json + */ + /** + * Sample code: Get all SaaS resources. + * + * @param manager Entry point to SaaSManager. + */ + public static void getAllSaaSResources(com.azure.resourcemanager.saas.SaaSManager manager) { + manager.saasResources().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelCreateOrUpdateSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelCreateOrUpdateSamples.java new file mode 100644 index 000000000000..9c3e127c1ce1 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +import com.azure.resourcemanager.saas.models.PaymentChannelType; +import com.azure.resourcemanager.saas.models.SaasCreationProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SaasSubscriptionLevel CreateOrUpdate. */ +public final class SaasSubscriptionLevelCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasPut.json + */ + /** + * Sample code: Create subscription level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void createSubscriptionLevelSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .define("MyContosoSubscription") + .withExistingResourceGroup("my-saas-rg") + .withRegion("global") + .withName("MyContosoSubscription") + .withProperties( + new SaasCreationProperties() + .withOfferId("contosoOffer") + .withPublisherId("microsoft-contoso") + .withSkuId("free") + .withPaymentChannelType(PaymentChannelType.SUBSCRIPTION_DELEGATED) + .withPaymentChannelMetadata(mapOf("AzureSubscriptionId", "155af98a-3205-47e7-883b-a2ab9db9f88d")) + .withSaasResourceName("MyContosoSubscription") + .withTermId("hjdtn7tfnxcy")) + .create(); + } + + @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/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelDeleteSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelDeleteSamples.java new file mode 100644 index 000000000000..44a6f6f3af99 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +/** Samples for SaasSubscriptionLevel Delete. */ +public final class SaasSubscriptionLevelDeleteSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasDelete.json + */ + /** + * Sample code: Delete Subscription Level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void deleteSubscriptionLevelSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .delete("my-saas-rg", "MyContosoSubscription", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelGetByResourceGroupSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelGetByResourceGroupSamples.java new file mode 100644 index 000000000000..83ce3ef6b420 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +/** Samples for SaasSubscriptionLevel GetByResourceGroup. */ +public final class SaasSubscriptionLevelGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasGet.json + */ + /** + * Sample code: Get subscription level saas resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSubscriptionLevelSaasResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .getByResourceGroupWithResponse("my-saas-rg", "MyContosoSubscription", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListAccessTokenSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListAccessTokenSamples.java new file mode 100644 index 000000000000..26ec26473d8e --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListAccessTokenSamples.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.saas.generated; + +/** Samples for SaasSubscriptionLevel ListAccessToken. */ +public final class SaasSubscriptionLevelListAccessTokenSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/ListAccessTokenPost.json + */ + /** + * Sample code: List subscription level SaaS resource access token. + * + * @param manager Entry point to SaaSManager. + */ + public static void listSubscriptionLevelSaaSResourceAccessToken( + com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .listAccessTokenWithResponse("my-saas-rg", "MyContosoSubscription", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListByResourceGroupSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListByResourceGroupSamples.java new file mode 100644 index 000000000000..bfb80d1d1fe5 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +/** Samples for SaasSubscriptionLevel ListByResourceGroup. */ +public final class SaasSubscriptionLevelListByResourceGroupSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasGetAllInResourceGroup.json + */ + /** + * Sample code: Get subscription level saas resources in resource group. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSubscriptionLevelSaasResourcesInResourceGroup( + com.azure.resourcemanager.saas.SaaSManager manager) { + manager.saasSubscriptionLevels().listByResourceGroup("my-saas-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListSamples.java new file mode 100644 index 000000000000..1e1a98fc42d3 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +/** Samples for SaasSubscriptionLevel List. */ +public final class SaasSubscriptionLevelListSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasGetAllInAzureSubscription.json + */ + /** + * Sample code: Get subscription level saas resources in Azure subscription. + * + * @param manager Entry point to SaaSManager. + */ + public static void getSubscriptionLevelSaasResourcesInAzureSubscription( + com.azure.resourcemanager.saas.SaaSManager manager) { + manager.saasSubscriptionLevels().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelMoveResourcesSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelMoveResourcesSamples.java new file mode 100644 index 000000000000..c2d5a02c7450 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelMoveResourcesSamples.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.saas.generated; + +import com.azure.resourcemanager.saas.models.MoveResource; +import java.util.Arrays; + +/** Samples for SaasSubscriptionLevel MoveResources. */ +public final class SaasSubscriptionLevelMoveResourcesSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/ResourceMove.json + */ + /** + * Sample code: Move of a subscription Level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void moveOfASubscriptionLevelSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .moveResources( + "my-saas-rg", + new MoveResource() + .withTargetResourceGroup( + "/subscriptions/5122d0a3-1e10-4baf-bdc5-c2a452489525/resourceGroups/new-saas-rg") + .withResources( + Arrays + .asList( + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas1", + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas2", + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas3")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelUpdateSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelUpdateSamples.java new file mode 100644 index 000000000000..f61c9fa5adaa --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +import com.azure.resourcemanager.saas.models.SaasCreationProperties; +import com.azure.resourcemanager.saas.models.SaasResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SaasSubscriptionLevel Update. */ +public final class SaasSubscriptionLevelUpdateSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasPatch.json + */ + /** + * Sample code: Update subscription level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void updateSubscriptionLevelSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + SaasResource resource = + manager + .saasSubscriptionLevels() + .getByResourceGroupWithResponse("my-saas-rg", "MyContosoSubscription", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).withProperties(new SaasCreationProperties().withSkuId("premium")).apply(); + } + + @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/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelUpdateToUnsubscribedSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelUpdateToUnsubscribedSamples.java new file mode 100644 index 000000000000..9eef8c198bd8 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelUpdateToUnsubscribedSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +import com.azure.resourcemanager.saas.models.DeleteOptions; + +/** Samples for SaasSubscriptionLevel UpdateToUnsubscribed. */ +public final class SaasSubscriptionLevelUpdateToUnsubscribedSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/SaasUnsubscribe.json + */ + /** + * Sample code: Unsubscribe Subscription Level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void unsubscribeSubscriptionLevelSaaSResource(com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .updateToUnsubscribed( + "my-saas-rg", + "MyContosoSubscription", + new DeleteOptions() + .withUnsubscribeOnly(true) + .withReasonCode(0.0F) + .withFeedback("No longer need this SaaS"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelValidateMoveResourcesSamples.java b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelValidateMoveResourcesSamples.java new file mode 100644 index 000000000000..9e20a03a0593 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelValidateMoveResourcesSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +import com.azure.resourcemanager.saas.models.MoveResource; +import java.util.Arrays; + +/** Samples for SaasSubscriptionLevel ValidateMoveResources. */ +public final class SaasSubscriptionLevelValidateMoveResourcesSamples { + /* + * x-ms-original-file: specification/saas/resource-manager/Microsoft.SaaS/preview/2018-03-01-beta/examples/saasSubscriptionLevel/ValidateResourceMove.json + */ + /** + * Sample code: Validate move of a subscription Level SaaS resource. + * + * @param manager Entry point to SaaSManager. + */ + public static void validateMoveOfASubscriptionLevelSaaSResource( + com.azure.resourcemanager.saas.SaaSManager manager) { + manager + .saasSubscriptionLevels() + .validateMoveResourcesWithResponse( + "my-saas-rg", + new MoveResource() + .withTargetResourceGroup( + "/subscriptions/5122d0a3-1e10-4baf-bdc5-c2a452489525/resourceGroups/new-saas-rg") + .withResources( + Arrays + .asList( + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas1", + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas2", + "/subscriptions/c825645b-e31b-9cf4-1cee-2aba9e58bc7c/resourceGroups/my-saas-rg/providers/Microsoft.SaaS/resources/saas3")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/saas/ci.yml b/sdk/saas/ci.yml new file mode 100644 index 000000000000..d96d16d5db59 --- /dev/null +++ b/sdk/saas/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/saas/ci.yml + - sdk/saas/azure-resourcemanager-saas/ + exclude: + - sdk/saas/pom.xml + - sdk/saas/azure-resourcemanager-saas/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/saas/ci.yml + - sdk/saas/azure-resourcemanager-saas/ + exclude: + - sdk/saas/pom.xml + - sdk/saas/azure-resourcemanager-saas/pom.xml + +parameters: + - name: release_azureresourcemanagersaas + displayName: azure-resourcemanager-saas + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: saas + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-saas + groupId: com.azure.resourcemanager + safeName: azureresourcemanagersaas + releaseInBatch: ${{ parameters.release_azureresourcemanagersaas }} diff --git a/sdk/saas/pom.xml b/sdk/saas/pom.xml new file mode 100644 index 000000000000..d3399dc59502 --- /dev/null +++ b/sdk/saas/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-saas-service + pom + 1.0.0 + + + azure-resourcemanager-saas + +