diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 3acc4771ced77..6bb0d4c2de20d 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -326,6 +326,7 @@ com.azure.resourcemanager:azure-resourcemanager-storagepool;1.0.0-beta.1;1.0.0-b com.azure.resourcemanager:azure-resourcemanager-dataprotection;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loadtestservice;1.0.0-beta.1;1.0.0-beta.2 +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.0.0 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/pom.xml b/pom.xml index 928014fa07f54..3df0c64132ffa 100644 --- a/pom.xml +++ b/pom.xml @@ -818,6 +818,7 @@ sdk/resourcehealth sdk/resourcemanager sdk/resourcemover + sdk/saas sdk/schemaregistry sdk/search sdk/security diff --git a/sdk/saas/azure-resourcemanager-saas/CHANGELOG.md b/sdk/saas/azure-resourcemanager-saas/CHANGELOG.md new file mode 100644 index 0000000000000..26c6b7627d69d --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-12-16) + +- 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 0000000000000..d3ab98f1c2b88 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/README.md @@ -0,0 +1,102 @@ +# 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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of 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 environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by 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](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[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 diff --git a/sdk/saas/azure-resourcemanager-saas/SAMPLE.md b/sdk/saas/azure-resourcemanager-saas/SAMPLE.md new file mode 100644 index 0000000000000..c610ea4ac8d4c --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/SAMPLE.md @@ -0,0 +1,598 @@ +# 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 +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### ResourceProvider_SaasResourceListAccessToken + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### SaaS_CreateResource + +```java +import com.azure.core.util.Context; +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")), + 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.core.util.Context; +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), + Context.NONE); + } +} +``` + +### SaaS_GetResource + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### SaaS_UpdateResource + +```java +import com.azure.core.util.Context; +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")), + 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 +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### SaasResources_List + +```java +import com.azure.core.util.Context; + +/** 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(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 +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_ListAccessToken + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_MoveResources + +```java +import com.azure.core.util.Context; +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")), + Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_Update + +```java +import com.azure.core.util.Context; +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", 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.core.util.Context; +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"), + Context.NONE); + } +} +``` + +### SaasSubscriptionLevel_ValidateMoveResources + +```java +import com.azure.core.util.Context; +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")), + 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 0000000000000..ab47948c5ed6c --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/pom.xml @@ -0,0 +1,81 @@ + + 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 + true + false + + + + + + com.azure + azure-core + 1.23.1 + + + com.azure + azure-core-management + 1.4.4 + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + 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 0000000000000..9e42e92593a72 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/SaaSManager.java @@ -0,0 +1,315 @@ +// 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.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.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); + } + + /** + * 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 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 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 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' 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) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + 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); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of Applications. */ + public Applications applications() { + if (this.applications == null) { + this.applications = new ApplicationsImpl(clientObject.getApplications(), this); + } + return applications; + } + + /** @return Resource collection API of SaaS. */ + public SaaS saaS() { + if (this.saaS == null) { + this.saaS = new SaaSImpl(clientObject.getSaaS(), this); + } + return saaS; + } + + /** @return Resource collection API of SaasResources. */ + public SaasResources saasResources() { + if (this.saasResources == null) { + this.saasResources = new SaasResourcesImpl(clientObject.getSaasResources(), this); + } + return saasResources; + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of SaasSubscriptionLevels. */ + public SaasSubscriptionLevels saasSubscriptionLevels() { + if (this.saasSubscriptionLevels == null) { + this.saasSubscriptionLevels = + new SaasSubscriptionLevelsImpl(clientObject.getSaasSubscriptionLevels(), this); + } + return saasSubscriptionLevels; + } + + /** @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 0000000000000..6ec468ec36704 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/ApplicationsClient.java @@ -0,0 +1,39 @@ +// 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. + */ + @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. + */ + @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 0000000000000..d527c356c89b0 --- /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. + */ + @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. + */ + @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 0000000000000..20dd2e01dd38e --- /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). + * @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); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response saasResourceListAccessTokenWithResponse(String resourceId, Context context); +} 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 0000000000000..e25cd1541e0c0 --- /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 completion. + */ + @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 completion. + */ + @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). + * @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); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getResourceWithResponse(String resourceId, 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.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 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 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 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 0000000000000..8adc10ccdcb4f --- /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 0000000000000..1da91dd9e1ced --- /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 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 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 0000000000000..2467bd80aeaee --- /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. + */ + @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. + */ + @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 0000000000000..89eb2ebb7cd31 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/fluent/SaasSubscriptionLevelsClient.java @@ -0,0 +1,436 @@ +// 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + * @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); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, 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.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 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 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 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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @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. + * @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); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listAccessTokenWithResponse( + String resourceGroupName, String resourceName, 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); + + /** + * 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response validateMoveResourcesWithResponse( + 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. + * @return the completion. + */ + @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 completion. + */ + @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 0000000000000..b7d3156f6d0c0 --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** the ISV access token result response. */ +@Fluent +public final class AccessTokenResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccessTokenResultInner.class); + + /* + * The Publisher Offer Base Uri + */ + @JsonProperty(value = "publisherOfferBaseUri") + private String publisherOfferBaseUri; + + /* + * The generated token + */ + @JsonProperty(value = "token") + private String token; + + /** + * 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 0000000000000..006a43de5ab86 --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.saas.models.SaasAppProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** the saasApp resource. */ +@Fluent +public final class SaasAppInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasAppInner.class); + + /* + * 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; + + /** + * 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 0000000000000..86b89f246429d --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.saas.models.SaasAppOperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** saas app operations. */ +@Fluent +public final class SaasAppOperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasAppOperationInner.class); + + /* + * 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; + + /** + * 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 0000000000000..c12b6ae8de2ec --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.saas.models.SaasResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasResourceInner.class); + + /* + * 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; + + /** + * 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 0000000000000..c2a4e2c8f596e --- /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 0000000000000..380ba414189b5 --- /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 0000000000000..cc2958a548650 --- /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 0000000000000..6d50c2b781333 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ApplicationsClientImpl.java @@ -0,0 +1,317 @@ +// 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.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.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 { + private final ClientLogger logger = new ClientLogger(ApplicationsClientImpl.class); + + /** 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") + private 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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 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. + */ + @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 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. + */ + @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 0000000000000..6cf2526170e46 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ApplicationsImpl.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.ApplicationsClient; +import com.azure.resourcemanager.saas.fluent.models.SaasAppInner; +import com.azure.resourcemanager.saas.models.Applications; +import com.azure.resourcemanager.saas.models.SaasApp; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ApplicationsImpl implements Applications { + @JsonIgnore private 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 0000000000000..8595132cfed87 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// 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.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.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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** 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") + private 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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. + */ + @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 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. + */ + @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 0000000000000..ff6d6d57676a4 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/OperationsImpl.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.OperationsClient; +import com.azure.resourcemanager.saas.fluent.models.SaasAppOperationInner; +import com.azure.resourcemanager.saas.models.Operations; +import com.azure.resourcemanager.saas.models.SaasAppOperation; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private 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 0000000000000..38cd3029e839c --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,184 @@ +// 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.core.util.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** 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") + private 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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono saasResourceListAccessTokenAsync(String resourceId) { + return saasResourceListAccessTokenWithResponseAsync(resourceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 saasResourceListAccessTokenAsync(resourceId).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). + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response saasResourceListAccessTokenWithResponse( + String resourceId, Context context) { + return saasResourceListAccessTokenWithResponseAsync(resourceId, context).block(); + } +} 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 0000000000000..14ccc897d3bb0 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/ResourceProvidersImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private 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 AccessTokenResult saasResourceListAccessToken(String resourceId) { + AccessTokenResultInner inner = this.serviceClient().saasResourceListAccessToken(resourceId); + if (inner != null) { + return new AccessTokenResultImpl(inner, this.manager()); + } else { + return null; + } + } + + 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; + } + } + + 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 0000000000000..970f05455c4f0 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSClientImpl.java @@ -0,0 +1,868 @@ +// 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(SaaSClientImpl.class); + + /** 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") + private 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, 204}) + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceId, DeleteOptions parameters) { + return 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceId, DeleteOptions parameters, Context context) { + return 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 the completion. + */ + @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 the completion. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getResourceAsync(String resourceId) { + return getResourceWithResponseAsync(resourceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getResourceAsync(resourceId).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). + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getResourceWithResponse(String resourceId, Context context) { + return getResourceWithResponseAsync(resourceId, context).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. + * @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) + 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. + */ + @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 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 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginUpdateResource( + String resourceId, SaasResourceCreation parameters) { + return 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginUpdateResource( + String resourceId, SaasResourceCreation parameters, Context context) { + return 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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 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 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginCreateResource( + SaasResourceCreation parameters) { + return 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginCreateResource( + SaasResourceCreation parameters, Context context) { + return 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. + */ + @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. + */ + @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 0000000000000..93a0894f5d8f0 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSImpl.java @@ -0,0 +1,104 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SaaSImpl implements SaaS { + @JsonIgnore private 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 SaasResource getResource(String resourceId) { + SaasResourceInner inner = this.serviceClient().getResource(resourceId); + if (inner != null) { + return new SaasResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + 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 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 0000000000000..e8cae11c1a2d3 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSManagementClientBuilder.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.CookiePolicy; +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 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 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 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() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + SaaSManagementClientImpl client = + new SaaSManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + 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 0000000000000..bb49f9c3d13c7 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSManagementClientImpl.java @@ -0,0 +1,378 @@ +// 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.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 java.util.Map; +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 { + private final ClientLogger logger = new ClientLogger(SaaSManagementClientImpl.class); + + /** 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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return 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)); + } + } +} 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 0000000000000..6bf7d2d44184f --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSOperationsClientImpl.java @@ -0,0 +1,257 @@ +// 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(SaaSOperationsClientImpl.class); + + /** 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") + private 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. + */ + @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. + */ + @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 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 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 information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginGet(String operationId) { + return 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 information about the specified operation progress. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginGet(String operationId, Context context) { + return 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. + */ + @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. + */ + @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 0000000000000..5e460d4e85368 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaaSOperationsImpl.java @@ -0,0 +1,53 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SaaSOperationsImpl implements SaaSOperations { + @JsonIgnore private 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 0000000000000..ecb3590558a86 --- /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 0000000000000..1afeb41ef7c6b --- /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 0000000000000..03090de5ef103 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourceImpl.java @@ -0,0 +1,214 @@ +// 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 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 AccessTokenResult listAccessToken() { + return serviceManager.saasSubscriptionLevels().listAccessToken(resourceGroupName, resourceName); + } + + public Response listAccessTokenWithResponse(Context context) { + return serviceManager + .saasSubscriptionLevels() + .listAccessTokenWithResponse(resourceGroupName, resourceName, context); + } + + 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 0000000000000..4b992071a14c2 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourcesClientImpl.java @@ -0,0 +1,269 @@ +// 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.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.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 { + private final ClientLogger logger = new ClientLogger(SaasResourcesClientImpl.class); + + /** 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") + private 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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. + */ + @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 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. + */ + @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 0000000000000..f3831b440c75d --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasResourcesImpl.java @@ -0,0 +1,46 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SaasResourcesImpl implements SaasResources { + @JsonIgnore private 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 0000000000000..0e9364e812950 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasSubscriptionLevelsClientImpl.java @@ -0,0 +1,2394 @@ +// 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(SaasSubscriptionLevelsClientImpl.class); + + /** 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") + private 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, 204}) + @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, 204}) + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, resourceName).block(); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName, context).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. + * @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) + 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. + */ + @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 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 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + return 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context) { + return 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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 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 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters) { + return 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 saaS REST API resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaasResourceInner> beginUpdate( + String resourceGroupName, String resourceName, SaasResourceCreation parameters, Context context) { + return 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. + */ + @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. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName) { + return 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceName, Context context) { + return 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 the completion. + */ + @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 the completion. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginUpdateToUnsubscribed( + String resourceGroupName, String resourceName, DeleteOptions parameters) { + return 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginUpdateToUnsubscribed( + String resourceGroupName, String resourceName, DeleteOptions parameters, Context context) { + return 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 the completion. + */ + @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 the completion. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAccessTokenAsync(String resourceGroupName, String resourceName) { + return listAccessTokenWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 listAccessTokenAsync(resourceGroupName, resourceName).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. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAccessTokenWithResponse( + String resourceGroupName, String resourceName, Context context) { + return listAccessTokenWithResponseAsync(resourceGroupName, resourceName, 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. + * @return the completion. + */ + @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 completion. + */ + @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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateMoveResourcesAsync(String resourceGroupName, MoveResource moveResourceParameter) { + return validateMoveResourcesWithResponseAsync(resourceGroupName, moveResourceParameter) + .flatMap((Response res) -> 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. + * @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) { + validateMoveResourcesAsync(resourceGroupName, moveResourceParameter).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validateMoveResourcesWithResponse( + String resourceGroupName, MoveResource moveResourceParameter, Context context) { + return validateMoveResourcesWithResponseAsync(resourceGroupName, moveResourceParameter, context).block(); + } + + /** + * 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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginMoveResources( + String resourceGroupName, MoveResource moveResourceParameter) { + return 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginMoveResources( + String resourceGroupName, MoveResource moveResourceParameter, Context context) { + return 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 the completion. + */ + @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 the completion. + */ + @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 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. + */ + @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 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. + */ + @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 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. + */ + @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 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. + */ + @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 0000000000000..e8c16e7e637f1 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/implementation/SaasSubscriptionLevelsImpl.java @@ -0,0 +1,226 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SaasSubscriptionLevelsImpl implements SaasSubscriptionLevels { + @JsonIgnore private 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 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 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 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 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 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 void validateMoveResources(String resourceGroupName, MoveResource moveResourceParameter) { + this.serviceClient().validateMoveResources(resourceGroupName, moveResourceParameter); + } + + public Response validateMoveResourcesWithResponse( + String resourceGroupName, MoveResource moveResourceParameter, Context context) { + return this + .serviceClient() + .validateMoveResourcesWithResponse(resourceGroupName, moveResourceParameter, context); + } + + 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 0000000000000..97d6a065bf3ca --- /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 0000000000000..69985c9a59ce0 --- /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 0000000000000..bab001beed1b0 --- /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 0000000000000..ff32c31ee44eb --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/Applications.java @@ -0,0 +1,34 @@ +// 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. + */ + 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. + */ + 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 0000000000000..7f866b367da2f --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** delete Options. */ +@Fluent +public final class DeleteOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeleteOptions.class); + + /* + * 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; + + /** + * 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 0000000000000..89045e3bfe02a --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Resource Move Options. */ +@Fluent +public final class MoveResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MoveResource.class); + + /* + * 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; + + /** + * 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 0000000000000..d6dce56eaee49 --- /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. + */ + 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. + */ + 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 0000000000000..8d302d0d26c14 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/PaymentChannelType.java @@ -0,0 +1,34 @@ +// 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; + +/** Defines values for PaymentChannelType. */ +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 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); + } + + /** @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 0000000000000..cbfd413f3bb6f --- /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). + * @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); + + /** + * 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. + */ + Response saasResourceListAccessTokenWithResponse(String resourceId, Context context); +} 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 0000000000000..4fc99efc180a3 --- /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). + * @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); + + /** + * 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. + */ + Response getResourceWithResponse(String resourceId, 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. + */ + 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/SaaSCreateResourceHeaders.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSCreateResourceHeaders.java new file mode 100644 index 0000000000000..4248f46e614bc --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSCreateResourceHeaders.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SaaSCreateResourceHeaders model. */ +@Fluent +public final class SaaSCreateResourceHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaaSCreateResourceHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the SaaSCreateResourceHeaders object itself. + */ + public SaaSCreateResourceHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the SaaSCreateResourceHeaders object itself. + */ + public SaaSCreateResourceHeaders withLocation(String location) { + this.location = location; + 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/SaaSCreateResourceResponse.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSCreateResourceResponse.java new file mode 100644 index 0000000000000..f26e4431f4ee0 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSCreateResourceResponse.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.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; + +/** Contains all response data for the createResource operation. */ +public final class SaaSCreateResourceResponse extends ResponseBase { + /** + * Creates an instance of SaaSCreateResourceResponse. + * + * @param request the request which resulted in this SaaSCreateResourceResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SaaSCreateResourceResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + SaasResourceInner value, + SaaSCreateResourceHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public SaasResourceInner getValue() { + return super.getValue(); + } +} 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 0000000000000..cd5d1cfb66860 --- /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/SaaSOperationsGetHeaders.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSOperationsGetHeaders.java new file mode 100644 index 0000000000000..32d31104a9b66 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSOperationsGetHeaders.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SaaSOperationsGetHeaders model. */ +@Fluent +public final class SaaSOperationsGetHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaaSOperationsGetHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the SaaSOperationsGetHeaders object itself. + */ + public SaaSOperationsGetHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the SaaSOperationsGetHeaders object itself. + */ + public SaaSOperationsGetHeaders withLocation(String location) { + this.location = location; + 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/SaaSOperationsGetResponse.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSOperationsGetResponse.java new file mode 100644 index 0000000000000..a9ab68ae1d7a2 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSOperationsGetResponse.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.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; + +/** Contains all response data for the get operation. */ +public final class SaaSOperationsGetResponse extends ResponseBase { + /** + * Creates an instance of SaaSOperationsGetResponse. + * + * @param request the request which resulted in this SaaSOperationsGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SaaSOperationsGetResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + SaasResourceInner value, + SaaSOperationsGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public SaasResourceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSUpdateResourceHeaders.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSUpdateResourceHeaders.java new file mode 100644 index 0000000000000..0a2c6f4020eca --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSUpdateResourceHeaders.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SaaSUpdateResourceHeaders model. */ +@Fluent +public final class SaaSUpdateResourceHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaaSUpdateResourceHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the SaaSUpdateResourceHeaders object itself. + */ + public SaaSUpdateResourceHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the SaaSUpdateResourceHeaders object itself. + */ + public SaaSUpdateResourceHeaders withLocation(String location) { + this.location = location; + 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/SaaSUpdateResourceResponse.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSUpdateResourceResponse.java new file mode 100644 index 0000000000000..6624d45d50346 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaaSUpdateResourceResponse.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.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; + +/** Contains all response data for the updateResource operation. */ +public final class SaaSUpdateResourceResponse extends ResponseBase { + /** + * Creates an instance of SaaSUpdateResourceResponse. + * + * @param request the request which resulted in this SaaSUpdateResourceResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SaaSUpdateResourceResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + SaasResourceInner value, + SaaSUpdateResourceHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public SaasResourceInner getValue() { + return super.getValue(); + } +} 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 0000000000000..1c806ec63bb40 --- /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 0000000000000..e859490bb6b26 --- /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 0000000000000..2b1445a56aa55 --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Saas app operation display. */ +@Fluent +public final class SaasAppOperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasAppOperationDisplay.class); + + /* + * 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; + + /** + * 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 0000000000000..3933c78ab4792 --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.saas.fluent.models.SaasAppOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** saas app operation response with continuation. */ +@Fluent +public final class SaasAppOperationsResponseWithContinuation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasAppOperationsResponseWithContinuation.class); + + /* + * 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; + + /** + * 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 0000000000000..664672d52684d --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Saas resource plan. */ +@Fluent +public final class SaasAppPlan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasAppPlan.class); + + /* + * 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; + + /** + * 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 0000000000000..ed07963ef4bf2 --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Saas resource properties. */ +@Fluent +public final class SaasAppProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasAppProperties.class); + + /* + * the Saas resource status. + */ + @JsonProperty(value = "status") + private SaasAppStatus status; + + /* + * the resource plan details. + */ + @JsonProperty(value = "saasAppPlan") + private SaasAppPlan saasAppPlan; + + /** + * 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 0000000000000..261f309d7d6e7 --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.saas.fluent.models.SaasAppInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** saas app response with continuation. */ +@Fluent +public final class SaasAppResponseWithContinuation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasAppResponseWithContinuation.class); + + /* + * 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; + + /** + * 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 0000000000000..d8f04ffe0dc9d --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasAppStatus.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SaasAppStatus. */ +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 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); + } + + /** @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 0000000000000..e4ab4a8f98fe0 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasCreationProperties.java @@ -0,0 +1,345 @@ +// 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.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** properties for creation saas. */ +@Fluent +public class SaasCreationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasCreationProperties.class); + + /* + * 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; + + /** + * 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 0000000000000..f49f5ee51a392 --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** saas resource properties. */ +@Fluent +public class SaasProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasProperties.class); + + /* + * 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; + + /** + * 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 0000000000000..0dc6b2c51b7cb --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The current Term object. */ +@Fluent +public final class SaasPropertiesTerm { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasPropertiesTerm.class); + + /* + * 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; + + /** + * 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 0000000000000..1930d8c4a268f --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResource.java @@ -0,0 +1,272 @@ +// 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 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. + * + * @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(); + + /** + * 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. + */ + Response listAccessTokenWithResponse(Context context); +} 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 0000000000000..59707e2b38dbc --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasResourceCreation.class); + + /* + * 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; + + /** + * 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 0000000000000..33666ca395806 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasResourceProperties.class); + + /* + * 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; + + /** + * 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 0000000000000..c26aa3702ab0c --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** saas resources response with continuation. */ +@Fluent +public final class SaasResourceResponseWithContinuation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasResourceResponseWithContinuation.class); + + /* + * 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; + + /** + * 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 0000000000000..202a50997814a --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasResourceStatus.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SaasResourceStatus. */ +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 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); + } + + /** @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 0000000000000..6750d24a313ca --- /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. + */ + 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. + */ + 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 0000000000000..c02765170075c --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevels.java @@ -0,0 +1,255 @@ +// 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + * @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); + + /** + * 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. + */ + Response getByResourceGroupWithResponse( + 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. + */ + 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. + * @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); + + /** + * 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. + */ + Response listAccessTokenWithResponse( + String resourceGroupName, String resourceName, 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); + + /** + * 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 response. + */ + Response validateMoveResourcesWithResponse( + 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. + */ + 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. + */ + 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. + */ + 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/SaasSubscriptionLevelsCreateOrUpdateHeaders.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..bc83eca33b768 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsCreateOrUpdateHeaders.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SaasSubscriptionLevelsCreateOrUpdateHeaders model. */ +@Fluent +public final class SaasSubscriptionLevelsCreateOrUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasSubscriptionLevelsCreateOrUpdateHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the SaasSubscriptionLevelsCreateOrUpdateHeaders object itself. + */ + public SaasSubscriptionLevelsCreateOrUpdateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the SaasSubscriptionLevelsCreateOrUpdateHeaders object itself. + */ + public SaasSubscriptionLevelsCreateOrUpdateHeaders withLocation(String location) { + this.location = location; + 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/SaasSubscriptionLevelsCreateOrUpdateResponse.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..87490216b9e68 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsCreateOrUpdateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; + +/** Contains all response data for the createOrUpdate operation. */ +public final class SaasSubscriptionLevelsCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of SaasSubscriptionLevelsCreateOrUpdateResponse. + * + * @param request the request which resulted in this SaasSubscriptionLevelsCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SaasSubscriptionLevelsCreateOrUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + SaasResourceInner value, + SaasSubscriptionLevelsCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public SaasResourceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsDeleteHeaders.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsDeleteHeaders.java new file mode 100644 index 0000000000000..572efd7693e3a --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsDeleteHeaders.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SaasSubscriptionLevelsDeleteHeaders model. */ +@Fluent +public final class SaasSubscriptionLevelsDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasSubscriptionLevelsDeleteHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the SaasSubscriptionLevelsDeleteHeaders object itself. + */ + public SaasSubscriptionLevelsDeleteHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the SaasSubscriptionLevelsDeleteHeaders object itself. + */ + public SaasSubscriptionLevelsDeleteHeaders withLocation(String location) { + this.location = location; + 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/SaasSubscriptionLevelsDeleteResponse.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsDeleteResponse.java new file mode 100644 index 0000000000000..dc0fc1086b660 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsDeleteResponse.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.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class SaasSubscriptionLevelsDeleteResponse + extends ResponseBase { + /** + * Creates an instance of SaasSubscriptionLevelsDeleteResponse. + * + * @param request the request which resulted in this SaasSubscriptionLevelsDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SaasSubscriptionLevelsDeleteResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + SaasSubscriptionLevelsDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsMoveResourcesHeaders.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsMoveResourcesHeaders.java new file mode 100644 index 0000000000000..3a87eaca0727f --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsMoveResourcesHeaders.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SaasSubscriptionLevelsMoveResourcesHeaders model. */ +@Fluent +public final class SaasSubscriptionLevelsMoveResourcesHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasSubscriptionLevelsMoveResourcesHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the SaasSubscriptionLevelsMoveResourcesHeaders object itself. + */ + public SaasSubscriptionLevelsMoveResourcesHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the SaasSubscriptionLevelsMoveResourcesHeaders object itself. + */ + public SaasSubscriptionLevelsMoveResourcesHeaders withLocation(String location) { + this.location = location; + 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/SaasSubscriptionLevelsMoveResourcesResponse.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsMoveResourcesResponse.java new file mode 100644 index 0000000000000..fee2c43e82bb2 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsMoveResourcesResponse.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.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the moveResources operation. */ +public final class SaasSubscriptionLevelsMoveResourcesResponse + extends ResponseBase { + /** + * Creates an instance of SaasSubscriptionLevelsMoveResourcesResponse. + * + * @param request the request which resulted in this SaasSubscriptionLevelsMoveResourcesResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SaasSubscriptionLevelsMoveResourcesResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + SaasSubscriptionLevelsMoveResourcesHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsUpdateHeaders.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsUpdateHeaders.java new file mode 100644 index 0000000000000..9da660d350af3 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsUpdateHeaders.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SaasSubscriptionLevelsUpdateHeaders model. */ +@Fluent +public final class SaasSubscriptionLevelsUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SaasSubscriptionLevelsUpdateHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the SaasSubscriptionLevelsUpdateHeaders object itself. + */ + public SaasSubscriptionLevelsUpdateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the SaasSubscriptionLevelsUpdateHeaders object itself. + */ + public SaasSubscriptionLevelsUpdateHeaders withLocation(String location) { + this.location = location; + 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/SaasSubscriptionLevelsUpdateResponse.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsUpdateResponse.java new file mode 100644 index 0000000000000..b6adf95b09999 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsUpdateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.saas.fluent.models.SaasResourceInner; + +/** Contains all response data for the update operation. */ +public final class SaasSubscriptionLevelsUpdateResponse + extends ResponseBase { + /** + * Creates an instance of SaasSubscriptionLevelsUpdateResponse. + * + * @param request the request which resulted in this SaasSubscriptionLevelsUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SaasSubscriptionLevelsUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + SaasResourceInner value, + SaasSubscriptionLevelsUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public SaasResourceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsUpdateToUnsubscribedHeaders.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsUpdateToUnsubscribedHeaders.java new file mode 100644 index 0000000000000..2dbe02f4e0c40 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsUpdateToUnsubscribedHeaders.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SaasSubscriptionLevelsUpdateToUnsubscribedHeaders model. */ +@Fluent +public final class SaasSubscriptionLevelsUpdateToUnsubscribedHeaders { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(SaasSubscriptionLevelsUpdateToUnsubscribedHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the SaasSubscriptionLevelsUpdateToUnsubscribedHeaders object itself. + */ + public SaasSubscriptionLevelsUpdateToUnsubscribedHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the SaasSubscriptionLevelsUpdateToUnsubscribedHeaders object itself. + */ + public SaasSubscriptionLevelsUpdateToUnsubscribedHeaders withLocation(String location) { + this.location = location; + 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/SaasSubscriptionLevelsUpdateToUnsubscribedResponse.java b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsUpdateToUnsubscribedResponse.java new file mode 100644 index 0000000000000..21bf4fadfe709 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/main/java/com/azure/resourcemanager/saas/models/SaasSubscriptionLevelsUpdateToUnsubscribedResponse.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.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the updateToUnsubscribed operation. */ +public final class SaasSubscriptionLevelsUpdateToUnsubscribedResponse + extends ResponseBase { + /** + * Creates an instance of SaasSubscriptionLevelsUpdateToUnsubscribedResponse. + * + * @param request the request which resulted in this SaasSubscriptionLevelsUpdateToUnsubscribedResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SaasSubscriptionLevelsUpdateToUnsubscribedResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + SaasSubscriptionLevelsUpdateToUnsubscribedHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} 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 0000000000000..a7d7ae46d8110 --- /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 0000000000000..6cbd16ecdc37c --- /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 0000000000000..10dc5e8a3bb6e --- /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 0000000000000..54876629a21f7 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/ApplicationsListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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 0000000000000..e968773a6f04d --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/OperationsListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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 0000000000000..80adb86bbb5b6 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/ResourceProviderSaasResourceListAccessTokenSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +import com.azure.core.util.Context; + +/** 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", 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 0000000000000..7008a4b288aa1 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSCreateResourceSamples.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.generated; + +import com.azure.core.util.Context; +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")), + 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 0000000000000..c10260a018223 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSDeleteSamples.java @@ -0,0 +1,28 @@ +// 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.core.util.Context; +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), + 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 0000000000000..3357e644c9127 --- /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; + +import com.azure.core.util.Context; + +/** 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", 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 0000000000000..91bfd12a97c4d --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSOperationGetSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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 0000000000000..7447bd17e7650 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaaSUpdateResourceSamples.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.generated; + +import com.azure.core.util.Context; +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")), + 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 0000000000000..31811c21f80d2 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasResourcesListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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 0000000000000..9c3e127c1ce16 --- /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 0000000000000..da1980aa5abed --- /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; + +import com.azure.core.util.Context; + +/** 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", 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 0000000000000..c3fe6c81e5d97 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +import com.azure.core.util.Context; + +/** 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", 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 0000000000000..3c2c15f00ef5f --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListAccessTokenSamples.java @@ -0,0 +1,25 @@ +// 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.core.util.Context; + +/** 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", 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 0000000000000..300e9d817b869 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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 0000000000000..810d916c9f77e --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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 0000000000000..99787969c95ad --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelMoveResourcesSamples.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.core.util.Context; +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")), + 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 0000000000000..b1adab7780937 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelUpdateSamples.java @@ -0,0 +1,42 @@ +// 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.core.util.Context; +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", 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 0000000000000..41938abd41666 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelUpdateToUnsubscribedSamples.java @@ -0,0 +1,32 @@ +// 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.core.util.Context; +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"), + 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 0000000000000..c90d979b7a868 --- /dev/null +++ b/sdk/saas/azure-resourcemanager-saas/src/samples/java/com/azure/resourcemanager/saas/generated/SaasSubscriptionLevelValidateMoveResourcesSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.saas.generated; + +import com.azure.core.util.Context; +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")), + Context.NONE); + } +} diff --git a/sdk/saas/ci.yml b/sdk/saas/ci.yml new file mode 100644 index 0000000000000..4337982dc6af3 --- /dev/null +++ b/sdk/saas/ci.yml @@ -0,0 +1,39 @@ +# 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 + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: saas + Artifacts: + - name: azure-resourcemanager-saas + groupId: com.azure.resourcemanager + safeName: azureresourcemanagersaas diff --git a/sdk/saas/pom.xml b/sdk/saas/pom.xml new file mode 100644 index 0000000000000..e9691ac37ab06 --- /dev/null +++ b/sdk/saas/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-saas-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-saas + + + +