diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 33acbc6f17a41..1a9dcf18b186e 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -335,6 +335,7 @@ com.azure.resourcemanager:azure-resourcemanager-automanage;1.0.0-beta.1;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-edgeorder;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-securityinsights;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-oep;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-resources-generated;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 b0c1dafb9f652..18e1707aefff2 100644 --- a/pom.xml +++ b/pom.xml @@ -949,6 +949,7 @@ sdk/resourcehealth sdk/resourcemanager sdk/resourcemover + sdk/resources sdk/schemaregistry sdk/search sdk/security diff --git a/sdk/resources/azure-resourcemanager-resources-generated/CHANGELOG.md b/sdk/resources/azure-resourcemanager-resources-generated/CHANGELOG.md new file mode 100644 index 0000000000000..4ea8449288f21 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-02-19) + +- Azure Resource Manager Resource client library for Java. This package contains Microsoft Azure SDK for Resource Management SDK. Provides operations for working with resources and resource groups. Package tag package-resources-2021-04. 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/resources/azure-resourcemanager-resources-generated/README.md b/sdk/resources/azure-resourcemanager-resources-generated/README.md new file mode 100644 index 0000000000000..73cc83fd01f71 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Resource client library for Java + +Azure Resource Manager Resource client library for Java. + +This package contains Microsoft Azure SDK for Resource Management SDK. Provides operations for working with resources and resource groups. Package tag package-resources-2021-04. 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-resources-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-resources-generated + 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(); +ResourceManager manager = ResourceManager + .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/resources/azure-resourcemanager-resources-generated/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/resources/azure-resourcemanager-resources-generated/SAMPLE.md b/sdk/resources/azure-resourcemanager-resources-generated/SAMPLE.md new file mode 100644 index 0000000000000..cd4bc54ad70da --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/SAMPLE.md @@ -0,0 +1,897 @@ +# Code snippets and samples + + +## Deployments + +- [CalculateTemplateHash](#deployments_calculatetemplatehash) +- [CreateOrUpdate](#deployments_createorupdate) +- [CreateOrUpdateAtManagementGroupScope](#deployments_createorupdateatmanagementgroupscope) +- [CreateOrUpdateAtScope](#deployments_createorupdateatscope) +- [CreateOrUpdateAtSubscriptionScope](#deployments_createorupdateatsubscriptionscope) +- [CreateOrUpdateAtTenantScope](#deployments_createorupdateattenantscope) +- [WhatIf](#deployments_whatif) +- [WhatIfAtManagementGroupScope](#deployments_whatifatmanagementgroupscope) +- [WhatIfAtSubscriptionScope](#deployments_whatifatsubscriptionscope) +- [WhatIfAtTenantScope](#deployments_whatifattenantscope) + +## ProviderResourceTypes + +- [List](#providerresourcetypes_list) + +## Providers + +- [Get](#providers_get) +- [GetAtTenantScope](#providers_getattenantscope) +- [List](#providers_list) +- [ProviderPermissions](#providers_providerpermissions) + +## ResourceGroups + +- [CreateOrUpdate](#resourcegroups_createorupdate) +- [Delete](#resourcegroups_delete) +- [ExportTemplate](#resourcegroups_exporttemplate) + +## TagOperations + +- [CreateOrUpdateAtScope](#tagoperations_createorupdateatscope) +- [GetAtScope](#tagoperations_getatscope) +### Deployments_CalculateTemplateHash + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; + +/** Samples for Deployments CalculateTemplateHash. */ +public final class DeploymentsCalculateTemplateHashSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/CalculateTemplateHash.json + */ + /** + * Sample code: Calculate template hash. + * + * @param manager Entry point to ResourceManager. + */ + public static void calculateTemplateHash(com.azure.resourcemanager.resources.generated.ResourceManager manager) + throws IOException { + manager + .deployments() + .calculateTemplateHashWithResponse( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"$schema\":\"http://schemas.management.azure.com/deploymentTemplate?api-version=2014-04-01-preview\",\"contentVersion\":\"1.0.0.0\",\"outputs\":{\"string\":{\"type\":\"string\",\"value\":\"myvalue\"}},\"parameters\":{\"string\":{\"type\":\"string\"}},\"resources\":[],\"variables\":{\"array\":[1,2,3,4],\"bool\":true,\"int\":42,\"object\":{\"object\":{\"location\":\"West" + + " US\",\"vmSize\":\"Large\"}},\"string\":\"string\"}}", + Object.class, + SerializerEncoding.JSON), + Context.NONE); + } +} +``` + +### Deployments_CreateOrUpdate + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.OnErrorDeployment; +import com.azure.resourcemanager.resources.generated.models.OnErrorDeploymentType; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments CreateOrUpdate. */ +public final class DeploymentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentResourceGroup.json + */ + /** + * Sample code: Create a deployment that will deploy a template with a uri and queryString. + * + * @param manager Entry point to ResourceManager. + */ + public static void createADeploymentThatWillDeployATemplateWithAUriAndQueryString( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .define("my-deployment") + .withExistingResourceGroup("my-resource-group") + .withProperties( + new DeploymentProperties() + .withTemplateLink( + new TemplateLink() + .withUri("https://example.com/exampleTemplate.json") + .withQueryString( + "sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=xxxxxxxx0xxxxxxxxxxxxx%2bxxxxxxxxxxxxxxxxxxxx%3d")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)) + .create(); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentResourceGroupTemplateSpecsWithId.json + */ + /** + * Sample code: Create a deployment that will deploy a templateSpec with the given resourceId. + * + * @param manager Entry point to ResourceManager. + */ + public static void createADeploymentThatWillDeployATemplateSpecWithTheGivenResourceId( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .define("my-deployment") + .withExistingResourceGroup("my-resource-group") + .withProperties( + new DeploymentProperties() + .withTemplateLink( + new TemplateLink() + .withId( + "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)) + .create(); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentWithOnErrorDeploymentSpecificDeployment.json + */ + /** + * Sample code: Create a deployment that will redeploy another deployment on failure. + * + * @param manager Entry point to ResourceManager. + */ + public static void createADeploymentThatWillRedeployAnotherDeploymentOnFailure( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .define("my-deployment") + .withExistingResourceGroup("my-resource-group") + .withProperties( + new DeploymentProperties() + .withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.COMPLETE) + .withOnErrorDeployment( + new OnErrorDeployment() + .withType(OnErrorDeploymentType.SPECIFIC_DEPLOYMENT) + .withDeploymentName("name-of-deployment-to-use"))) + .create(); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentWithOnErrorDeploymentLastSuccessful.json + */ + /** + * Sample code: Create a deployment that will redeploy the last successful deployment on failure. + * + * @param manager Entry point to ResourceManager. + */ + public static void createADeploymentThatWillRedeployTheLastSuccessfulDeploymentOnFailure( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .define("my-deployment") + .withExistingResourceGroup("my-resource-group") + .withProperties( + new DeploymentProperties() + .withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.COMPLETE) + .withOnErrorDeployment(new OnErrorDeployment().withType(OnErrorDeploymentType.LAST_SUCCESSFUL))) + .create(); + } +} +``` + +### Deployments_CreateOrUpdateAtManagementGroupScope + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.ScopedDeployment; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments CreateOrUpdateAtManagementGroupScope. */ +public final class DeploymentsCreateOrUpdateAtManagementGroupScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentAtManagementGroup.json + */ + /** + * Sample code: Create deployment at management group scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void createDeploymentAtManagementGroupScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .createOrUpdateAtManagementGroupScope( + "my-management-group-id", + "my-deployment", + new ScopedDeployment() + .withLocation("eastus") + .withProperties( + new DeploymentProperties() + .withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} +``` + +### Deployments_CreateOrUpdateAtScope + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.Deployment; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Deployments CreateOrUpdateAtScope. */ +public final class DeploymentsCreateOrUpdateAtScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentAtScope.json + */ + /** + * Sample code: Create deployment at a given scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void createDeploymentAtAGivenScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .createOrUpdateAtScope( + "providers/Microsoft.Management/managementGroups/my-management-group-id", + "my-deployment", + new Deployment() + .withLocation("eastus") + .withProperties( + new DeploymentProperties() + .withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)) + .withTags(mapOf("tagKey1", "tag-value-1", "tagKey2", "tag-value-2")), + 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; + } +} +``` + +### Deployments_CreateOrUpdateAtSubscriptionScope + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.Deployment; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments CreateOrUpdateAtSubscriptionScope. */ +public final class DeploymentsCreateOrUpdateAtSubscriptionScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentSubscriptionTemplateSpecsWithId.json + */ + /** + * Sample code: Create a deployment that will deploy a templateSpec with the given resourceId. + * + * @param manager Entry point to ResourceManager. + */ + public static void createADeploymentThatWillDeployATemplateSpecWithTheGivenResourceId( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .createOrUpdateAtSubscriptionScope( + "my-deployment", + new Deployment() + .withLocation("eastus") + .withProperties( + new DeploymentProperties() + .withTemplateLink( + new TemplateLink() + .withId( + "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} +``` + +### Deployments_CreateOrUpdateAtTenantScope + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.ScopedDeployment; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Deployments CreateOrUpdateAtTenantScope. */ +public final class DeploymentsCreateOrUpdateAtTenantScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentAtTenant.json + */ + /** + * Sample code: Create deployment at tenant scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void createDeploymentAtTenantScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .createOrUpdateAtTenantScope( + "tenant-dep01", + new ScopedDeployment() + .withLocation("eastus") + .withProperties( + new DeploymentProperties() + .withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)) + .withTags(mapOf("tagKey1", "tag-value-1", "tagKey2", "tag-value-2")), + 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; + } +} +``` + +### Deployments_WhatIf + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIfProperties; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments WhatIf. */ +public final class DeploymentsWhatIfSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PostDeploymentWhatIfOnResourceGroup.json + */ + /** + * Sample code: Predict template changes at resource group scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void predictTemplateChangesAtResourceGroupScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .whatIf( + "my-resource-group", + "my-deployment", + new DeploymentWhatIf() + .withProperties( + new DeploymentWhatIfProperties() + .withTemplateLink(new TemplateLink()) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} +``` + +### Deployments_WhatIfAtManagementGroupScope + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIfProperties; +import com.azure.resourcemanager.resources.generated.models.ScopedDeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments WhatIfAtManagementGroupScope. */ +public final class DeploymentsWhatIfAtManagementGroupScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PostDeploymentWhatIfOnManagementGroup.json + */ + /** + * Sample code: Predict template changes at management group scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void predictTemplateChangesAtManagementGroupScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .whatIfAtManagementGroupScope( + "myManagementGruop", + "exampleDeploymentName", + new ScopedDeploymentWhatIf() + .withLocation("eastus") + .withProperties( + new DeploymentWhatIfProperties() + .withTemplateLink(new TemplateLink()) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} +``` + +### Deployments_WhatIfAtSubscriptionScope + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIfProperties; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments WhatIfAtSubscriptionScope. */ +public final class DeploymentsWhatIfAtSubscriptionScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PostDeploymentWhatIfOnSubscription.json + */ + /** + * Sample code: Predict template changes at subscription scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void predictTemplateChangesAtSubscriptionScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .whatIfAtSubscriptionScope( + "my-deployment", + new DeploymentWhatIf() + .withLocation("westus") + .withProperties( + new DeploymentWhatIfProperties() + .withTemplateLink(new TemplateLink()) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} +``` + +### Deployments_WhatIfAtTenantScope + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIfProperties; +import com.azure.resourcemanager.resources.generated.models.ScopedDeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments WhatIfAtTenantScope. */ +public final class DeploymentsWhatIfAtTenantScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PostDeploymentWhatIfOnTenant.json + */ + /** + * Sample code: Predict template changes at management group scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void predictTemplateChangesAtManagementGroupScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .whatIfAtTenantScope( + "exampleDeploymentName", + new ScopedDeploymentWhatIf() + .withLocation("eastus") + .withProperties( + new DeploymentWhatIfProperties() + .withTemplateLink(new TemplateLink()) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} +``` + +### ProviderResourceTypes_List + +```java +import com.azure.core.util.Context; + +/** Samples for ProviderResourceTypes List. */ +public final class ProviderResourceTypesListSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetProviderResourceTypes.json + */ + /** + * Sample code: Get provider resource types. + * + * @param manager Entry point to ResourceManager. + */ + public static void getProviderResourceTypes(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.providerResourceTypes().listWithResponse("Microsoft.TestRP", null, Context.NONE); + } +} +``` + +### Providers_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Providers Get. */ +public final class ProvidersGetSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetProvider.json + */ + /** + * Sample code: Get provider. + * + * @param manager Entry point to ResourceManager. + */ + public static void getProvider(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.providers().getWithResponse("Microsoft.TestRP1", null, Context.NONE); + } +} +``` + +### Providers_GetAtTenantScope + +```java +import com.azure.core.util.Context; + +/** Samples for Providers GetAtTenantScope. */ +public final class ProvidersGetAtTenantScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetNamedProviderAtTenant.json + */ + /** + * Sample code: Get a resource provider at tenant scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void getAResourceProviderAtTenantScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.providers().getAtTenantScopeWithResponse("Microsoft.Storage", "resourceTypes/aliases", Context.NONE); + } +} +``` + +### Providers_List + +```java +import com.azure.core.util.Context; + +/** Samples for Providers List. */ +public final class ProvidersListSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetProviders.json + */ + /** + * Sample code: Get providers. + * + * @param manager Entry point to ResourceManager. + */ + public static void getProviders(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.providers().list(null, Context.NONE); + } +} +``` + +### Providers_ProviderPermissions + +```java +import com.azure.core.util.Context; + +/** Samples for Providers ProviderPermissions. */ +public final class ProvidersProviderPermissionsSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetProviderPermissions.json + */ + /** + * Sample code: Get provider resource types. + * + * @param manager Entry point to ResourceManager. + */ + public static void getProviderResourceTypes(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.providers().providerPermissionsWithResponse("Microsoft.TestRP", Context.NONE); + } +} +``` + +### ResourceGroups_CreateOrUpdate + +```java +/** Samples for ResourceGroups CreateOrUpdate. */ +public final class ResourceGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/CreateResourceGroup.json + */ + /** + * Sample code: Create or update a resource group. + * + * @param manager Entry point to ResourceManager. + */ + public static void createOrUpdateAResourceGroup( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.resourceGroups().define("my-resource-group").withRegion("eastus").create(); + } +} +``` + +### ResourceGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ResourceGroups Delete. */ +public final class ResourceGroupsDeleteSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ForceDeleteVMsInResourceGroup.json + */ + /** + * Sample code: Force delete all the Virtual Machines in a resource group. + * + * @param manager Entry point to ResourceManager. + */ + public static void forceDeleteAllTheVirtualMachinesInAResourceGroup( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.resourceGroups().delete("my-resource-group", "Microsoft.Compute/virtualMachines", Context.NONE); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ForceDeleteVMsAndVMSSInResourceGroup.json + */ + /** + * Sample code: Force delete all the Virtual Machines and Virtual Machine Scale Sets in a resource group. + * + * @param manager Entry point to ResourceManager. + */ + public static void forceDeleteAllTheVirtualMachinesAndVirtualMachineScaleSetsInAResourceGroup( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .resourceGroups() + .delete( + "my-resource-group", + "Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets", + Context.NONE); + } +} +``` + +### ResourceGroups_ExportTemplate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.resources.generated.models.ExportTemplateRequest; +import java.util.Arrays; + +/** Samples for ResourceGroups ExportTemplate. */ +public final class ResourceGroupsExportTemplateSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ExportResourceGroup.json + */ + /** + * Sample code: Export a resource group. + * + * @param manager Entry point to ResourceManager. + */ + public static void exportAResourceGroup(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .resourceGroups() + .exportTemplate( + "my-resource-group", + new ExportTemplateRequest() + .withResources(Arrays.asList("*")) + .withOptions("IncludeParameterDefaultValue,IncludeComments"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ExportResourceGroupWithFiltering.json + */ + /** + * Sample code: Export a resource group with filtering. + * + * @param manager Entry point to ResourceManager. + */ + public static void exportAResourceGroupWithFiltering( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .resourceGroups() + .exportTemplate( + "my-resource-group", + new ExportTemplateRequest() + .withResources( + Arrays + .asList( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/My.RP/myResourceType/myFirstResource")) + .withOptions("SkipResourceNameParameterization"), + Context.NONE); + } +} +``` + +### TagOperations_CreateOrUpdateAtScope + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.TagsResourceInner; +import com.azure.resourcemanager.resources.generated.models.Tags; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TagOperations CreateOrUpdateAtScope. */ +public final class TagOperationsCreateOrUpdateAtScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutTagsResource.json + */ + /** + * Sample code: Update tags on a resource. + * + * @param manager Entry point to ResourceManager. + */ + public static void updateTagsOnAResource(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .tagOperations() + .createOrUpdateAtScopeWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm", + new TagsResourceInner() + .withProperties(new Tags().withTags(mapOf("tagKey1", "tag-value-1", "tagKey2", "tag-value-2"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutTagsSubscription.json + */ + /** + * Sample code: Update tags on a subscription. + * + * @param manager Entry point to ResourceManager. + */ + public static void updateTagsOnASubscription( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .tagOperations() + .createOrUpdateAtScopeWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000", + new TagsResourceInner() + .withProperties(new Tags().withTags(mapOf("tagKey1", "tag-value-1", "tagKey2", "tag-value-2"))), + 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; + } +} +``` + +### TagOperations_GetAtScope + +```java +import com.azure.core.util.Context; + +/** Samples for TagOperations GetAtScope. */ +public final class TagOperationsGetAtScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetTagsResource.json + */ + /** + * Sample code: Get tags on a resource. + * + * @param manager Entry point to ResourceManager. + */ + public static void getTagsOnAResource(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .tagOperations() + .getAtScopeWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm", + Context.NONE); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetTagsSubscription.json + */ + /** + * Sample code: Get tags on a subscription. + * + * @param manager Entry point to ResourceManager. + */ + public static void getTagsOnASubscription(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .tagOperations() + .getAtScopeWithResponse("subscriptions/00000000-0000-0000-0000-000000000000", Context.NONE); + } +} +``` + diff --git a/sdk/resources/azure-resourcemanager-resources-generated/pom.xml b/sdk/resources/azure-resourcemanager-resources-generated/pom.xml new file mode 100644 index 0000000000000..f5c8ab82e4eca --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-resources-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Resource Management + This package contains Microsoft Azure SDK for Resource Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Provides operations for working with resources and resource groups. Package tag package-resources-2021-04. + 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 + + + + com.azure + azure-core + 1.25.0 + + + com.azure + azure-core-management + 1.5.2 + + + diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/ResourceManager.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/ResourceManager.java new file mode 100644 index 0000000000000..0c96f5b39eb20 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/ResourceManager.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated; + +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.resources.generated.fluent.ResourceManagementClient; +import com.azure.resourcemanager.resources.generated.implementation.DeploymentOperationsImpl; +import com.azure.resourcemanager.resources.generated.implementation.DeploymentsImpl; +import com.azure.resourcemanager.resources.generated.implementation.OperationsImpl; +import com.azure.resourcemanager.resources.generated.implementation.ProviderResourceTypesImpl; +import com.azure.resourcemanager.resources.generated.implementation.ProvidersImpl; +import com.azure.resourcemanager.resources.generated.implementation.ResourceGroupsImpl; +import com.azure.resourcemanager.resources.generated.implementation.ResourceManagementClientBuilder; +import com.azure.resourcemanager.resources.generated.implementation.ResourcesImpl; +import com.azure.resourcemanager.resources.generated.implementation.TagOperationsImpl; +import com.azure.resourcemanager.resources.generated.models.DeploymentOperations; +import com.azure.resourcemanager.resources.generated.models.Deployments; +import com.azure.resourcemanager.resources.generated.models.Operations; +import com.azure.resourcemanager.resources.generated.models.ProviderResourceTypes; +import com.azure.resourcemanager.resources.generated.models.Providers; +import com.azure.resourcemanager.resources.generated.models.ResourceGroups; +import com.azure.resourcemanager.resources.generated.models.Resources; +import com.azure.resourcemanager.resources.generated.models.TagOperations; +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 ResourceManager. Provides operations for working with resources and resource groups. */ +public final class ResourceManager { + private Operations operations; + + private Deployments deployments; + + private Providers providers; + + private ProviderResourceTypes providerResourceTypes; + + private Resources resources; + + private ResourceGroups resourceGroups; + + private TagOperations tagOperations; + + private DeploymentOperations deploymentOperations; + + private final ResourceManagementClient clientObject; + + private ResourceManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ResourceManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Resource service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Resource service API instance. + */ + public static ResourceManager 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 ResourceManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ResourceManager.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 Resource service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Resource service API instance. + */ + public ResourceManager 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.resources.generated") + .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 ResourceManager(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 Deployments. */ + public Deployments deployments() { + if (this.deployments == null) { + this.deployments = new DeploymentsImpl(clientObject.getDeployments(), this); + } + return deployments; + } + + /** @return Resource collection API of Providers. */ + public Providers providers() { + if (this.providers == null) { + this.providers = new ProvidersImpl(clientObject.getProviders(), this); + } + return providers; + } + + /** @return Resource collection API of ProviderResourceTypes. */ + public ProviderResourceTypes providerResourceTypes() { + if (this.providerResourceTypes == null) { + this.providerResourceTypes = new ProviderResourceTypesImpl(clientObject.getProviderResourceTypes(), this); + } + return providerResourceTypes; + } + + /** @return Resource collection API of Resources. */ + public Resources resources() { + if (this.resources == null) { + this.resources = new ResourcesImpl(clientObject.getResources(), this); + } + return resources; + } + + /** @return Resource collection API of ResourceGroups. */ + public ResourceGroups resourceGroups() { + if (this.resourceGroups == null) { + this.resourceGroups = new ResourceGroupsImpl(clientObject.getResourceGroups(), this); + } + return resourceGroups; + } + + /** @return Resource collection API of TagOperations. */ + public TagOperations tagOperations() { + if (this.tagOperations == null) { + this.tagOperations = new TagOperationsImpl(clientObject.getTagOperations(), this); + } + return tagOperations; + } + + /** @return Resource collection API of DeploymentOperations. */ + public DeploymentOperations deploymentOperations() { + if (this.deploymentOperations == null) { + this.deploymentOperations = new DeploymentOperationsImpl(clientObject.getDeploymentOperations(), this); + } + return deploymentOperations; + } + + /** + * @return Wrapped service client ResourceManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public ResourceManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/DeploymentOperationsClient.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/DeploymentOperationsClient.java new file mode 100644 index 0000000000000..7c82112054113 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/DeploymentOperationsClient.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentOperationInner; + +/** An instance of this class provides access to all the operations defined in DeploymentOperationsClient. */ +public interface DeploymentOperationsClient { + /** + * Gets a deployments operation. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentOperationInner getAtScope(String scope, String deploymentName, String operationId); + + /** + * Gets a deployments operation. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtScopeWithResponse( + String scope, String deploymentName, String operationId, Context context); + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtScope(String scope, String deploymentName); + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtScope( + String scope, String deploymentName, Integer top, Context context); + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentOperationInner getAtTenantScope(String deploymentName, String operationId); + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtTenantScopeWithResponse( + String deploymentName, String operationId, Context context); + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtTenantScope(String deploymentName); + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtTenantScope(String deploymentName, Integer top, Context context); + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentOperationInner getAtManagementGroupScope(String groupId, String deploymentName, String operationId); + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, String operationId, Context context); + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtManagementGroupScope(String groupId, String deploymentName); + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtManagementGroupScope( + String groupId, String deploymentName, Integer top, Context context); + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentOperationInner getAtSubscriptionScope(String deploymentName, String operationId); + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtSubscriptionScopeWithResponse( + String deploymentName, String operationId, Context context); + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtSubscriptionScope(String deploymentName); + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtSubscriptionScope( + String deploymentName, Integer top, Context context); + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentOperationInner get(String resourceGroupName, String deploymentName, String operationId); + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String deploymentName, String operationId, Context context); + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String deploymentName); + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, String deploymentName, Integer top, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/DeploymentsClient.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/DeploymentsClient.java new file mode 100644 index 0000000000000..c0077904de33a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/DeploymentsClient.java @@ -0,0 +1,1964 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.models.DeploymentExportResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExtendedInner; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentValidateResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.TemplateHashResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.WhatIfOperationResultInner; +import com.azure.resourcemanager.resources.generated.models.Deployment; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.ScopedDeployment; +import com.azure.resourcemanager.resources.generated.models.ScopedDeploymentWhatIf; + +/** An instance of this class provides access to all the operations defined in DeploymentsClient. */ +public interface DeploymentsClient { + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteAtScope(String scope, String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteAtScope(String scope, String deploymentName, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deleteAtScope(String scope, String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deleteAtScope(String scope, String deploymentName, Context context); + + /** + * Checks whether the deployment exists. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + boolean checkExistenceAtScope(String scope, String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkExistenceAtScopeWithResponse(String scope, String deploymentName, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtScope( + String scope, String deploymentName, Deployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtScope( + String scope, String deploymentName, Deployment parameters, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner createOrUpdateAtScope(String scope, String deploymentName, Deployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner createOrUpdateAtScope( + String scope, String deploymentName, Deployment parameters, Context context); + + /** + * Gets a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner getAtScope(String scope, String deploymentName); + + /** + * Gets a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtScopeWithResponse(String scope, String deploymentName, Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 cancelAtScope(String scope, String deploymentName); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelAtScopeWithResponse(String scope, String deploymentName, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentValidateResultInner> beginValidateAtScope( + String scope, String deploymentName, Deployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentValidateResultInner> beginValidateAtScope( + String scope, String deploymentName, Deployment parameters, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentValidateResultInner validateAtScope(String scope, String deploymentName, Deployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentValidateResultInner validateAtScope( + String scope, String deploymentName, Deployment parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deployment export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExportResultInner exportTemplateAtScope(String scope, String deploymentName); + + /** + * Exports the template used for specified deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportTemplateAtScopeWithResponse( + String scope, String deploymentName, Context context); + + /** + * Get all the deployments at the given scope. + * + * @param scope The resource scope. + * @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 the deployments at the given scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtScope(String scope); + + /** + * Get all the deployments at the given scope. + * + * @param scope The resource scope. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments at the given scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtScope(String scope, String filter, Integer top, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteAtTenantScope(String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteAtTenantScope(String deploymentName, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtTenantScope(String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtTenantScope(String deploymentName, Context context); + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + boolean checkExistenceAtTenantScope(String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkExistenceAtTenantScopeWithResponse(String deploymentName, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtTenantScope( + String deploymentName, ScopedDeployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtTenantScope( + String deploymentName, ScopedDeployment parameters, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner createOrUpdateAtTenantScope(String deploymentName, ScopedDeployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner createOrUpdateAtTenantScope( + String deploymentName, ScopedDeployment parameters, Context context); + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner getAtTenantScope(String deploymentName); + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtTenantScopeWithResponse(String deploymentName, Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @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 cancelAtTenantScope(String deploymentName); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelAtTenantScopeWithResponse(String deploymentName, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentValidateResultInner> beginValidateAtTenantScope( + String deploymentName, ScopedDeployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentValidateResultInner> beginValidateAtTenantScope( + String deploymentName, ScopedDeployment parameters, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentValidateResultInner validateAtTenantScope(String deploymentName, ScopedDeployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentValidateResultInner validateAtTenantScope( + String deploymentName, ScopedDeployment parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WhatIfOperationResultInner> beginWhatIfAtTenantScope( + String deploymentName, ScopedDeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WhatIfOperationResultInner> beginWhatIfAtTenantScope( + String deploymentName, ScopedDeploymentWhatIf parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WhatIfOperationResultInner whatIfAtTenantScope(String deploymentName, ScopedDeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WhatIfOperationResultInner whatIfAtTenantScope( + String deploymentName, ScopedDeploymentWhatIf parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExportResultInner exportTemplateAtTenantScope(String deploymentName); + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportTemplateAtTenantScopeWithResponse( + String deploymentName, Context context); + + /** + * Get all the deployments at the tenant scope. + * + * @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 the deployments at the tenant scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtTenantScope(); + + /** + * Get all the deployments at the tenant scope. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments at the tenant scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtTenantScope(String filter, Integer top, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteAtManagementGroupScope(String groupId, String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteAtManagementGroupScope( + String groupId, String deploymentName, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deleteAtManagementGroupScope(String groupId, String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deleteAtManagementGroupScope(String groupId, String deploymentName, Context context); + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + boolean checkExistenceAtManagementGroupScope(String groupId, String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkExistenceAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner createOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner createOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context); + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner getAtManagementGroupScope(String groupId, String deploymentName); + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 cancelAtManagementGroupScope(String groupId, String deploymentName); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelAtManagementGroupScopeWithResponse(String groupId, String deploymentName, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentValidateResultInner> + beginValidateAtManagementGroupScope(String groupId, String deploymentName, ScopedDeployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentValidateResultInner> + beginValidateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentValidateResultInner validateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentValidateResultInner validateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WhatIfOperationResultInner> beginWhatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WhatIfOperationResultInner> beginWhatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WhatIfOperationResultInner whatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WhatIfOperationResultInner whatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deployment export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExportResultInner exportTemplateAtManagementGroupScope(String groupId, String deploymentName); + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportTemplateAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context); + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group 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 all the deployments for a management group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtManagementGroupScope(String groupId); + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a management group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtManagementGroupScope( + String groupId, String filter, Integer top, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteAtSubscriptionScope(String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteAtSubscriptionScope(String deploymentName, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtSubscriptionScope(String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtSubscriptionScope(String deploymentName, Context context); + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + boolean checkExistenceAtSubscriptionScope(String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkExistenceAtSubscriptionScopeWithResponse(String deploymentName, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtSubscriptionScope( + String deploymentName, Deployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtSubscriptionScope( + String deploymentName, Deployment parameters, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner createOrUpdateAtSubscriptionScope(String deploymentName, Deployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner createOrUpdateAtSubscriptionScope( + String deploymentName, Deployment parameters, Context context); + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner getAtSubscriptionScope(String deploymentName); + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtSubscriptionScopeWithResponse(String deploymentName, Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @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 cancelAtSubscriptionScope(String deploymentName); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelAtSubscriptionScopeWithResponse(String deploymentName, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentValidateResultInner> + beginValidateAtSubscriptionScope(String deploymentName, Deployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentValidateResultInner> + beginValidateAtSubscriptionScope(String deploymentName, Deployment parameters, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentValidateResultInner validateAtSubscriptionScope(String deploymentName, Deployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentValidateResultInner validateAtSubscriptionScope( + String deploymentName, Deployment parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WhatIfOperationResultInner> beginWhatIfAtSubscriptionScope( + String deploymentName, DeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WhatIfOperationResultInner> beginWhatIfAtSubscriptionScope( + String deploymentName, DeploymentWhatIf parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WhatIfOperationResultInner whatIfAtSubscriptionScope(String deploymentName, DeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WhatIfOperationResultInner whatIfAtSubscriptionScope( + String deploymentName, DeploymentWhatIf parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExportResultInner exportTemplateAtSubscriptionScope(String deploymentName); + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportTemplateAtSubscriptionScopeWithResponse( + String deploymentName, Context context); + + /** + * Get all the deployments for a 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 all the deployments for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Integer top, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String deploymentName, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 deploymentName, Context context); + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + boolean checkExistence(String resourceGroupName, String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkExistenceWithResponse(String resourceGroupName, String deploymentName, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentExtendedInner> beginCreateOrUpdate( + String resourceGroupName, String deploymentName, Deployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentExtendedInner> beginCreateOrUpdate( + String resourceGroupName, String deploymentName, Deployment parameters, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner createOrUpdate(String resourceGroupName, String deploymentName, Deployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner createOrUpdate( + String resourceGroupName, String deploymentName, Deployment parameters, Context context); + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExtendedInner getByResourceGroup(String resourceGroupName, String deploymentName); + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String deploymentName, Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 cancel(String resourceGroupName, String deploymentName); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse(String resourceGroupName, String deploymentName, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentValidateResultInner> beginValidate( + String resourceGroupName, String deploymentName, Deployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentValidateResultInner> beginValidate( + String resourceGroupName, String deploymentName, Deployment parameters, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentValidateResultInner validate(String resourceGroupName, String deploymentName, Deployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentValidateResultInner validate( + String resourceGroupName, String deploymentName, Deployment parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WhatIfOperationResultInner> beginWhatIf( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WhatIfOperationResultInner> beginWhatIf( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WhatIfOperationResultInner whatIf(String resourceGroupName, String deploymentName, DeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WhatIfOperationResultInner whatIf( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deployment export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentExportResultInner exportTemplate(String resourceGroupName, String deploymentName); + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportTemplateWithResponse( + String resourceGroupName, String deploymentName, Context context); + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the deployments for a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Integer top, Context context); + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @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 result of the request to calculate template hash. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TemplateHashResultInner calculateTemplateHash(Object template); + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @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 result of the request to calculate template hash along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response calculateTemplateHashWithResponse(Object template, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/OperationsClient.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/OperationsClient.java new file mode 100644 index 0000000000000..b6e3e25ecb2b0 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/OperationsClient.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.resources.generated.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.resources.generated.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Microsoft.Resources REST API 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 result of the request to list Microsoft.Resources operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available Microsoft.Resources REST API 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 result of the request to list Microsoft.Resources operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ProviderResourceTypesClient.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ProviderResourceTypesClient.java new file mode 100644 index 0000000000000..7038bc2c88d4a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ProviderResourceTypesClient.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.resources.generated.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.resources.generated.fluent.models.ProviderResourceTypeListResultInner; + +/** An instance of this class provides access to all the operations defined in ProviderResourceTypesClient. */ +public interface ProviderResourceTypesClient { + /** + * List the resource types for a specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @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 list of resource types of a resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProviderResourceTypeListResultInner list(String resourceProviderNamespace); + + /** + * List the resource types for a specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 list of resource types of a resource provider along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceProviderNamespace, String expand, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ProvidersClient.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ProvidersClient.java new file mode 100644 index 0000000000000..60b8906d219e1 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ProvidersClient.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderInner; +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderPermissionListResultInner; +import com.azure.resourcemanager.resources.generated.models.ProviderRegistrationRequest; + +/** An instance of this class provides access to all the operations defined in ProvidersClient. */ +public interface ProvidersClient { + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @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 resource provider information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProviderInner unregister(String resourceProviderNamespace); + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @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 resource provider information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response unregisterWithResponse(String resourceProviderNamespace, Context context); + + /** + * Registers a management group with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param groupId The management group 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void registerAtManagementGroupScope(String resourceProviderNamespace, String groupId); + + /** + * Registers a management group with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param groupId The management group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response registerAtManagementGroupScopeWithResponse( + String resourceProviderNamespace, String groupId, Context context); + + /** + * Get the provider permissions. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @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 provider permissions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProviderPermissionListResultInner providerPermissions(String resourceProviderNamespace); + + /** + * Get the provider permissions. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the provider permissions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response providerPermissionsWithResponse( + String resourceProviderNamespace, Context context); + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @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 resource provider information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProviderInner register(String resourceProviderNamespace); + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param properties The third party consent for S2S. + * @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 resource provider information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response registerWithResponse( + String resourceProviderNamespace, ProviderRegistrationRequest properties, Context context); + + /** + * Gets all resource providers for a 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 all resource providers for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all resource providers for a subscription. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 resource providers for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String expand, Context context); + + /** + * Gets all resource providers for the tenant. + * + * @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 resource providers for the tenant as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtTenantScope(); + + /** + * Gets all resource providers for the tenant. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 resource providers for the tenant as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAtTenantScope(String expand, Context context); + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @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 specified resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProviderInner get(String resourceProviderNamespace); + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 specified resource provider along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceProviderNamespace, String expand, Context context); + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @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 specified resource provider at the tenant level. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProviderInner getAtTenantScope(String resourceProviderNamespace); + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 specified resource provider at the tenant level along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtTenantScopeWithResponse( + String resourceProviderNamespace, String expand, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ResourceGroupsClient.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ResourceGroupsClient.java new file mode 100644 index 0000000000000..2d4d46c923326 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ResourceGroupsClient.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.models.ResourceGroupExportResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupInner; +import com.azure.resourcemanager.resources.generated.models.ExportTemplateRequest; +import com.azure.resourcemanager.resources.generated.models.ResourceGroupPatchable; + +/** An instance of this class provides access to all the operations defined in ResourceGroupsClient. */ +public interface ResourceGroupsClient { + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + boolean checkExistence(String resourceGroupName); + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkExistenceWithResponse(String resourceGroupName, Context context); + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, + * underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed + * characters. + * @param parameters Parameters supplied to the create or update a 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 resource group information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceGroupInner createOrUpdate(String resourceGroupName, ResourceGroupInner parameters); + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, + * underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed + * characters. + * @param parameters Parameters supplied to the create or update a 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 resource group information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, ResourceGroupInner parameters, Context context); + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String forceDeletionTypes); + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String forceDeletionTypes, Context context); + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @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 forceDeletionTypes); + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName); + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @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 forceDeletionTypes, Context context); + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceGroupInner get(String resourceGroupName); + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, Context context); + + /** + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is + * the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a 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 resource group information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceGroupInner update(String resourceGroupName, ResourceGroupPatchable parameters); + + /** + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is + * the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a 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 resource group information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, ResourceGroupPatchable parameters, Context context); + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource group export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ResourceGroupExportResultInner> beginExportTemplate( + String resourceGroupName, ExportTemplateRequest parameters); + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource group export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ResourceGroupExportResultInner> beginExportTemplate( + String resourceGroupName, ExportTemplateRequest parameters, Context context); + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @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 resource group export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceGroupExportResultInner exportTemplate(String resourceGroupName, ExportTemplateRequest parameters); + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @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 resource group export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceGroupExportResultInner exportTemplate( + String resourceGroupName, ExportTemplateRequest parameters, Context context); + + /** + * Gets all the resource groups for a 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 all the resource groups for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. + * For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 the resource groups for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Integer top, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ResourceManagementClient.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ResourceManagementClient.java new file mode 100644 index 0000000000000..69cdcea6288e1 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ResourceManagementClient.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.resources.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ResourceManagementClient class. */ +public interface ResourceManagementClient { + /** + * Gets The Microsoft Azure subscription ID. + * + * @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 DeploymentsClient object to access its operations. + * + * @return the DeploymentsClient object. + */ + DeploymentsClient getDeployments(); + + /** + * Gets the ProvidersClient object to access its operations. + * + * @return the ProvidersClient object. + */ + ProvidersClient getProviders(); + + /** + * Gets the ProviderResourceTypesClient object to access its operations. + * + * @return the ProviderResourceTypesClient object. + */ + ProviderResourceTypesClient getProviderResourceTypes(); + + /** + * Gets the ResourcesClient object to access its operations. + * + * @return the ResourcesClient object. + */ + ResourcesClient getResources(); + + /** + * Gets the ResourceGroupsClient object to access its operations. + * + * @return the ResourceGroupsClient object. + */ + ResourceGroupsClient getResourceGroups(); + + /** + * Gets the TagOperationsClient object to access its operations. + * + * @return the TagOperationsClient object. + */ + TagOperationsClient getTagOperations(); + + /** + * Gets the DeploymentOperationsClient object to access its operations. + * + * @return the DeploymentOperationsClient object. + */ + DeploymentOperationsClient getDeploymentOperations(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ResourcesClient.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ResourcesClient.java new file mode 100644 index 0000000000000..2022dc32cc4c9 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/ResourcesClient.java @@ -0,0 +1,915 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.models.GenericResourceExpandedInner; +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceInner; +import com.azure.resourcemanager.resources.generated.models.ResourcesMoveInfo; + +/** An instance of this class provides access to all the operations defined in ResourcesClient. */ +public interface ResourcesClient { + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @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 the resources for a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) + * or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, + * plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For + * example, to filter by a resource type, use: $filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the + * filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, + * to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', + * name)<br><br>You can link more than one substringof together by adding and/or + * operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name + * and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + * the tags for each resource are not returned in the results.<br><br>You can use some properties + * together when filtering. The combinations you can use are: substringof and/or resourceType, plan and + * plan/publisher and plan/name, identity and identity/principalId. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns 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 the resources for a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, String filter, String expand, Integer top, Context context); + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters); + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginMoveResources( + String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context); + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving resources. + * @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 sourceResourceGroupName, ResourcesMoveInfo parameters); + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context); + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginValidateMoveResources( + String sourceResourceGroupName, ResourcesMoveInfo parameters); + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginValidateMoveResources( + String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context); + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving resources. + * @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 sourceResourceGroupName, ResourcesMoveInfo parameters); + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void validateMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context); + + /** + * Get all the resources in a 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 all the resources in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>Filter comparison operators include `eq` + * (equals) and `ne` (not equals) and may be used with the following properties: `location`, `resourceType`, + * `name`, `resourceGroup`, `identity`, `identity/principalId`, `plan`, `plan/publisher`, `plan/product`, + * `plan/name`, `plan/version`, and `plan/promotionCode`.<br><br>For example, to filter by a + * resource type, use `$filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'`<br><br><br>`substringof(value, property)` can be used + * to filter for substrings of the following currently-supported properties: `name` and + * `resourceGroup`<br><br>For example, to get all resources with 'demo' anywhere in the resource + * name, use `$filter=substringof('demo', name)`<br><br>Multiple substring operations can also be + * combined using `and`/`or` operators.<br><br>Note that any truncated number of results queried via + * `$top` may also not be compatible when using a filter.<br><br><br>Resources can be filtered + * by tag names and values. For example, to filter for a tag name and value, use `$filter=tagName eq 'tag1' and + * tagValue eq 'Value1'`. Note that when resources are filtered by tag name and value, <b>the original + * tags for each resource will not be returned in the results.</b> Any list of additional properties + * queried via `$expand` may also not be compatible when filtering by tag names/values. <br><br>For + * tag names only, resources can be filtered by prefix using the following syntax: `$filter=startswith(tagName, + * 'depart')`. This query will return all resources with a tag name prefixed by the phrase `depart` + * (i.e.`department`, `departureDate`, `departureTime`, etc.)<br><br><br>Note that some + * properties can be combined when filtering resources, which include the following: `substringof() and/or + * resourceType`, `plan and plan/publisher and plan/name`, and `identity and identity/principalId`. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns 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 the resources in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, String expand, Integer top, Context context); + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case + * insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the 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 whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + boolean checkExistence( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion); + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case + * insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the 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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkExistenceWithResponse( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context); + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion); + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context); + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the 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 resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion); + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the 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 resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context); + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GenericResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters); + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GenericResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context); + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating 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 resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenericResourceInner createOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters); + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating 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 resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenericResourceInner createOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context); + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GenericResourceInner> beginUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters); + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GenericResourceInner> beginUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context); + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating 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 resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenericResourceInner update( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters); + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating 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 resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenericResourceInner update( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context); + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenericResourceInner get( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion); + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the 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 a resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context); + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + boolean checkExistenceById(String resourceId, String apiVersion); + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkExistenceByIdWithResponse(String resourceId, String apiVersion, Context context); + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteById(String resourceId, String apiVersion); + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteById(String resourceId, String apiVersion, Context context); + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 deleteById(String resourceId, String apiVersion); + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 deleteById(String resourceId, String apiVersion, Context context); + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GenericResourceInner> beginCreateOrUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters); + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GenericResourceInner> beginCreateOrUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context); + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenericResourceInner createOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters); + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenericResourceInner createOrUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context); + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GenericResourceInner> beginUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters); + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GenericResourceInner> beginUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context); + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenericResourceInner updateById(String resourceId, String apiVersion, GenericResourceInner parameters); + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenericResourceInner updateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context); + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenericResourceInner getById(String resourceId, String apiVersion); + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 a resource by ID along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByIdWithResponse(String resourceId, String apiVersion, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/TagOperationsClient.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/TagOperationsClient.java new file mode 100644 index 0000000000000..52eee7c8eaa65 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/TagOperationsClient.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.resources.generated.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.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.TagDetailsInner; +import com.azure.resourcemanager.resources.generated.fluent.models.TagValueInner; +import com.azure.resourcemanager.resources.generated.fluent.models.TagsResourceInner; +import com.azure.resourcemanager.resources.generated.models.TagsPatchResource; + +/** An instance of this class provides access to all the operations defined in TagOperationsClient. */ +public interface TagOperationsClient { + /** + * This operation allows deleting a value from the list of predefined values for an existing predefined tag name. + * The value being deleted must not be in use as a tag value for the given tag name for any resource. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @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 deleteValue(String tagName, String tagValue); + + /** + * This operation allows deleting a value from the list of predefined values for an existing predefined tag name. + * The value being deleted must not be in use as a tag value for the given tag name for any resource. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteValueWithResponse(String tagName, String tagValue, Context context); + + /** + * This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag + * value can have a maximum of 256 characters. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 tag information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagValueInner createOrUpdateValue(String tagName, String tagValue); + + /** + * This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag + * value can have a maximum of 256 characters. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 tag information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateValueWithResponse(String tagName, String tagValue, Context context); + + /** + * This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name + * can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which + * are reserved for Azure use: 'microsoft', 'azure', 'windows'. + * + * @param tagName The name of the tag to create. + * @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 tag details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagDetailsInner createOrUpdate(String tagName); + + /** + * This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name + * can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which + * are reserved for Azure use: 'microsoft', 'azure', 'windows'. + * + * @param tagName The name of the tag to create. + * @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 tag details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String tagName, Context context); + + /** + * This operation allows deleting a name from the list of predefined tag names for the given subscription. The name + * being deleted must not be in use as a tag name for any resource. All predefined values for the given name must + * have already been deleted. + * + * @param tagName The name of the tag. + * @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 tagName); + + /** + * This operation allows deleting a name from the list of predefined tag names for the given subscription. The name + * being deleted must not be in use as a tag name for any resource. All predefined values for the given name must + * have already been deleted. + * + * @param tagName The name of the tag. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String tagName, Context context); + + /** + * This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and + * returns a summary of usage for each tag name and value under the given subscription. In case of a large number of + * tags, this operation may return a previously cached result. + * + * @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 list of subscription tags as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and + * returns a summary of usage for each tag name and value under the given subscription. In case of a large number of + * tags, this operation may return a previously cached result. + * + * @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 list of subscription tags as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The + * specified entity can have a maximum of 50 tags. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags API requests and responses. + * @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 wrapper resource for tags API requests and responses. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagsResourceInner createOrUpdateAtScope(String scope, TagsResourceInner parameters); + + /** + * This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The + * specified entity can have a maximum of 50 tags. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags API requests and responses. + * @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 wrapper resource for tags API requests and responses along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateAtScopeWithResponse( + String scope, TagsResourceInner parameters, Context context); + + /** + * This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. + * The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the + * entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the + * values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or + * name/value pairs. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags patch API request only. + * @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 wrapper resource for tags API requests and responses. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagsResourceInner updateAtScope(String scope, TagsPatchResource parameters); + + /** + * This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. + * The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the + * entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the + * values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or + * name/value pairs. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags patch API request only. + * @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 wrapper resource for tags API requests and responses along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateAtScopeWithResponse(String scope, TagsPatchResource parameters, Context context); + + /** + * Gets the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @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 entire set of tags on a resource or subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagsResourceInner getAtScope(String scope); + + /** + * Gets the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @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 entire set of tags on a resource or subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtScopeWithResponse(String scope, Context context); + + /** + * Deletes the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @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 deleteAtScope(String scope); + + /** + * Deletes the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteAtScopeWithResponse(String scope, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentExportResultInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentExportResultInner.java new file mode 100644 index 0000000000000..3bff85c2342c5 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentExportResultInner.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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 deployment export result. */ +@Fluent +public final class DeploymentExportResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentExportResultInner.class); + + /* + * The template content. + */ + @JsonProperty(value = "template") + private Object template; + + /** + * Get the template property: The template content. + * + * @return the template value. + */ + public Object template() { + return this.template; + } + + /** + * Set the template property: The template content. + * + * @param template the template value to set. + * @return the DeploymentExportResultInner object itself. + */ + public DeploymentExportResultInner withTemplate(Object template) { + this.template = template; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentExtendedInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentExtendedInner.java new file mode 100644 index 0000000000000..a9e67082b7706 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentExtendedInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.DeploymentPropertiesExtended; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Deployment information. */ +@Fluent +public final class DeploymentExtendedInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentExtendedInner.class); + + /* + * Deployment properties. + */ + @JsonProperty(value = "properties") + private DeploymentPropertiesExtended properties; + + /** + * Get the properties property: Deployment properties. + * + * @return the properties value. + */ + public DeploymentPropertiesExtended properties() { + return this.properties; + } + + /** + * Set the properties property: Deployment properties. + * + * @param properties the properties value to set. + * @return the DeploymentExtendedInner object itself. + */ + public DeploymentExtendedInner withProperties(DeploymentPropertiesExtended properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public DeploymentExtendedInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DeploymentExtendedInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentOperationInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentOperationInner.java new file mode 100644 index 0000000000000..3c658ef536963 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentOperationInner.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.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.DeploymentOperationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Deployment operation information. */ +@Fluent +public final class DeploymentOperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentOperationInner.class); + + /* + * Full deployment operation ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Deployment operation ID. + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private String operationId; + + /* + * Deployment properties. + */ + @JsonProperty(value = "properties") + private DeploymentOperationProperties properties; + + /** + * Get the id property: Full deployment operation ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the operationId property: Deployment operation ID. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the properties property: Deployment properties. + * + * @return the properties value. + */ + public DeploymentOperationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Deployment properties. + * + * @param properties the properties value to set. + * @return the DeploymentOperationInner object itself. + */ + public DeploymentOperationInner withProperties(DeploymentOperationProperties 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentValidateResultInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentValidateResultInner.java new file mode 100644 index 0000000000000..cb8f044950405 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/DeploymentValidateResultInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.DeploymentPropertiesExtended; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information from validate template deployment response. */ +@Fluent +public final class DeploymentValidateResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentValidateResultInner.class); + + /* + * Error Response The deployment validation error. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ManagementError error; + + /* + * The template deployment properties. + */ + @JsonProperty(value = "properties") + private DeploymentPropertiesExtended properties; + + /** + * Get the error property: Error Response The deployment validation error. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Get the properties property: The template deployment properties. + * + * @return the properties value. + */ + public DeploymentPropertiesExtended properties() { + return this.properties; + } + + /** + * Set the properties property: The template deployment properties. + * + * @param properties the properties value to set. + * @return the DeploymentValidateResultInner object itself. + */ + public DeploymentValidateResultInner withProperties(DeploymentPropertiesExtended 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/GenericResourceExpandedInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/GenericResourceExpandedInner.java new file mode 100644 index 0000000000000..45491608665ca --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/GenericResourceExpandedInner.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.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.ExtendedLocation; +import com.azure.resourcemanager.resources.generated.models.Identity; +import com.azure.resourcemanager.resources.generated.models.Plan; +import com.azure.resourcemanager.resources.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Resource information. */ +@Fluent +public final class GenericResourceExpandedInner extends GenericResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GenericResourceExpandedInner.class); + + /* + * The created time of the resource. This is only present if requested via + * the $expand query parameter. + */ + @JsonProperty(value = "createdTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdTime; + + /* + * The changed time of the resource. This is only present if requested via + * the $expand query parameter. + */ + @JsonProperty(value = "changedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime changedTime; + + /* + * The provisioning state of the resource. This is only present if + * requested via the $expand query parameter. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the createdTime property: The created time of the resource. This is only present if requested via the $expand + * query parameter. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * Get the changedTime property: The changed time of the resource. This is only present if requested via the $expand + * query parameter. + * + * @return the changedTime value. + */ + public OffsetDateTime changedTime() { + return this.changedTime; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. This is only present if requested via + * the $expand query parameter. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceExpandedInner withPlan(Plan plan) { + super.withPlan(plan); + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceExpandedInner withProperties(Object properties) { + super.withProperties(properties); + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceExpandedInner withKind(String kind) { + super.withKind(kind); + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceExpandedInner withManagedBy(String managedBy) { + super.withManagedBy(managedBy); + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceExpandedInner withSku(Sku sku) { + super.withSku(sku); + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceExpandedInner withIdentity(Identity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceExpandedInner withExtendedLocation(ExtendedLocation extendedLocation) { + super.withExtendedLocation(extendedLocation); + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceExpandedInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceExpandedInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/GenericResourceInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/GenericResourceInner.java new file mode 100644 index 0000000000000..d344694f0a774 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/GenericResourceInner.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.ExtendedLocation; +import com.azure.resourcemanager.resources.generated.models.Identity; +import com.azure.resourcemanager.resources.generated.models.Plan; +import com.azure.resourcemanager.resources.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Resource information. */ +@Fluent +public class GenericResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GenericResourceInner.class); + + /* + * The plan of the resource. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /* + * The resource properties. + */ + @JsonProperty(value = "properties") + private Object properties; + + /* + * The kind of the resource. + */ + @JsonProperty(value = "kind") + private String kind; + + /* + * ID of the resource that manages this resource. + */ + @JsonProperty(value = "managedBy") + private String managedBy; + + /* + * The SKU of the resource. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * Resource extended location. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /** + * Get the plan property: The plan of the resource. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: The plan of the resource. + * + * @param plan the plan value to set. + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the properties property: The resource properties. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: The resource properties. + * + * @param properties the properties value to set. + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the kind property: The kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of the resource. + * + * @param kind the kind value to set. + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the managedBy property: ID of the resource that manages this resource. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set the managedBy property: ID of the resource that manages this resource. + * + * @param managedBy the managedBy value to set. + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + + /** + * Get the sku property: The SKU of the resource. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of the resource. + * + * @param sku the sku value to set. + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the extendedLocation property: Resource extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: Resource extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (plan() != null) { + plan().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/OperationInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..1a5a4ec93b7af --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/OperationInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Microsoft.Resources operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ProviderInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ProviderInner.java new file mode 100644 index 0000000000000..52e92d8511d01 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ProviderInner.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.ProviderAuthorizationConsentState; +import com.azure.resourcemanager.resources.generated.models.ProviderResourceType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Resource provider information. */ +@Fluent +public final class ProviderInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderInner.class); + + /* + * The provider ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The namespace of the resource provider. + */ + @JsonProperty(value = "namespace") + private String namespace; + + /* + * The registration state of the resource provider. + */ + @JsonProperty(value = "registrationState", access = JsonProperty.Access.WRITE_ONLY) + private String registrationState; + + /* + * The registration policy of the resource provider. + */ + @JsonProperty(value = "registrationPolicy", access = JsonProperty.Access.WRITE_ONLY) + private String registrationPolicy; + + /* + * The collection of provider resource types. + */ + @JsonProperty(value = "resourceTypes", access = JsonProperty.Access.WRITE_ONLY) + private List resourceTypes; + + /* + * The provider authorization consent state. + */ + @JsonProperty(value = "providerAuthorizationConsentState") + private ProviderAuthorizationConsentState providerAuthorizationConsentState; + + /** + * Get the id property: The provider ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the namespace property: The namespace of the resource provider. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: The namespace of the resource provider. + * + * @param namespace the namespace value to set. + * @return the ProviderInner object itself. + */ + public ProviderInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the registrationState property: The registration state of the resource provider. + * + * @return the registrationState value. + */ + public String registrationState() { + return this.registrationState; + } + + /** + * Get the registrationPolicy property: The registration policy of the resource provider. + * + * @return the registrationPolicy value. + */ + public String registrationPolicy() { + return this.registrationPolicy; + } + + /** + * Get the resourceTypes property: The collection of provider resource types. + * + * @return the resourceTypes value. + */ + public List resourceTypes() { + return this.resourceTypes; + } + + /** + * Get the providerAuthorizationConsentState property: The provider authorization consent state. + * + * @return the providerAuthorizationConsentState value. + */ + public ProviderAuthorizationConsentState providerAuthorizationConsentState() { + return this.providerAuthorizationConsentState; + } + + /** + * Set the providerAuthorizationConsentState property: The provider authorization consent state. + * + * @param providerAuthorizationConsentState the providerAuthorizationConsentState value to set. + * @return the ProviderInner object itself. + */ + public ProviderInner withProviderAuthorizationConsentState( + ProviderAuthorizationConsentState providerAuthorizationConsentState) { + this.providerAuthorizationConsentState = providerAuthorizationConsentState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceTypes() != null) { + resourceTypes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ProviderPermissionListResultInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ProviderPermissionListResultInner.java new file mode 100644 index 0000000000000..d52c8f84c54ad --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ProviderPermissionListResultInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.ProviderPermission; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of provider permissions. */ +@Fluent +public final class ProviderPermissionListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderPermissionListResultInner.class); + + /* + * An array of provider permissions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: An array of provider permissions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of provider permissions. + * + * @param value the value value to set. + * @return the ProviderPermissionListResultInner object itself. + */ + public ProviderPermissionListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ProviderResourceTypeListResultInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ProviderResourceTypeListResultInner.java new file mode 100644 index 0000000000000..096e3fe417696 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ProviderResourceTypeListResultInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.ProviderResourceType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of resource types of a resource provider. */ +@Fluent +public final class ProviderResourceTypeListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderResourceTypeListResultInner.class); + + /* + * An array of resource types. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: An array of resource types. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of resource types. + * + * @param value the value value to set. + * @return the ProviderResourceTypeListResultInner object itself. + */ + public ProviderResourceTypeListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ResourceGroupExportResultInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ResourceGroupExportResultInner.java new file mode 100644 index 0000000000000..c7dba0d1ac9f3 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ResourceGroupExportResultInner.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.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource group export result. */ +@Fluent +public final class ResourceGroupExportResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGroupExportResultInner.class); + + /* + * The template content. + */ + @JsonProperty(value = "template") + private Object template; + + /* + * Error Response The template export error. + */ + @JsonProperty(value = "error") + private ManagementError error; + + /** + * Get the template property: The template content. + * + * @return the template value. + */ + public Object template() { + return this.template; + } + + /** + * Set the template property: The template content. + * + * @param template the template value to set. + * @return the ResourceGroupExportResultInner object itself. + */ + public ResourceGroupExportResultInner withTemplate(Object template) { + this.template = template; + return this; + } + + /** + * Get the error property: Error Response The template export error. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: Error Response The template export error. + * + * @param error the error value to set. + * @return the ResourceGroupExportResultInner object itself. + */ + public ResourceGroupExportResultInner withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ResourceGroupInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ResourceGroupInner.java new file mode 100644 index 0000000000000..c0f0c88bda126 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/ResourceGroupInner.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.ResourceGroupProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Resource group information. */ +@Fluent +public final class ResourceGroupInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGroupInner.class); + + /* + * The resource group properties. + */ + @JsonProperty(value = "properties") + private ResourceGroupProperties properties; + + /* + * The ID of the resource that manages this resource group. + */ + @JsonProperty(value = "managedBy") + private String managedBy; + + /** + * Get the properties property: The resource group properties. + * + * @return the properties value. + */ + public ResourceGroupProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource group properties. + * + * @param properties the properties value to set. + * @return the ResourceGroupInner object itself. + */ + public ResourceGroupInner withProperties(ResourceGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the managedBy property: The ID of the resource that manages this resource group. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set the managedBy property: The ID of the resource that manages this resource group. + * + * @param managedBy the managedBy value to set. + * @return the ResourceGroupInner object itself. + */ + public ResourceGroupInner withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceGroupInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceGroupInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TagDetailsInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TagDetailsInner.java new file mode 100644 index 0000000000000..4157e47556778 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TagDetailsInner.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.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.TagCount; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Tag details. */ +@Fluent +public final class TagDetailsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagDetailsInner.class); + + /* + * The tag name ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The tag name. + */ + @JsonProperty(value = "tagName") + private String tagName; + + /* + * The total number of resources that use the resource tag. When a tag is + * initially created and has no associated resources, the value is 0. + */ + @JsonProperty(value = "count") + private TagCount count; + + /* + * The list of tag values. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get the id property: The tag name ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the tagName property: The tag name. + * + * @return the tagName value. + */ + public String tagName() { + return this.tagName; + } + + /** + * Set the tagName property: The tag name. + * + * @param tagName the tagName value to set. + * @return the TagDetailsInner object itself. + */ + public TagDetailsInner withTagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Get the count property: The total number of resources that use the resource tag. When a tag is initially created + * and has no associated resources, the value is 0. + * + * @return the count value. + */ + public TagCount count() { + return this.count; + } + + /** + * Set the count property: The total number of resources that use the resource tag. When a tag is initially created + * and has no associated resources, the value is 0. + * + * @param count the count value to set. + * @return the TagDetailsInner object itself. + */ + public TagDetailsInner withCount(TagCount count) { + this.count = count; + return this; + } + + /** + * Get the values property: The list of tag values. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The list of tag values. + * + * @param values the values value to set. + * @return the TagDetailsInner object itself. + */ + public TagDetailsInner withValues(List values) { + this.values = values; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (count() != null) { + count().validate(); + } + if (values() != null) { + values().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TagValueInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TagValueInner.java new file mode 100644 index 0000000000000..12cee5668a186 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TagValueInner.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.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.TagCount; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Tag information. */ +@Fluent +public final class TagValueInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagValueInner.class); + + /* + * The tag value ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The tag value. + */ + @JsonProperty(value = "tagValue") + private String tagValue; + + /* + * The tag value count. + */ + @JsonProperty(value = "count") + private TagCount count; + + /** + * Get the id property: The tag value ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the tagValue property: The tag value. + * + * @return the tagValue value. + */ + public String tagValue() { + return this.tagValue; + } + + /** + * Set the tagValue property: The tag value. + * + * @param tagValue the tagValue value to set. + * @return the TagValueInner object itself. + */ + public TagValueInner withTagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + + /** + * Get the count property: The tag value count. + * + * @return the count value. + */ + public TagCount count() { + return this.count; + } + + /** + * Set the count property: The tag value count. + * + * @param count the count value to set. + * @return the TagValueInner object itself. + */ + public TagValueInner withCount(TagCount count) { + this.count = count; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (count() != null) { + count().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TagsResourceInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TagsResourceInner.java new file mode 100644 index 0000000000000..8d02a02681e5f --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TagsResourceInner.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.resources.generated.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.resources.generated.models.Tags; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Wrapper resource for tags API requests and responses. */ +@Fluent +public final class TagsResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsResourceInner.class); + + /* + * The set of tags. + */ + @JsonProperty(value = "properties", required = true) + private Tags properties; + + /** + * Get the properties property: The set of tags. + * + * @return the properties value. + */ + public Tags properties() { + return this.properties; + } + + /** + * Set the properties property: The set of tags. + * + * @param properties the properties value to set. + * @return the TagsResourceInner object itself. + */ + public TagsResourceInner withProperties(Tags properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property properties in model TagsResourceInner")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TemplateHashResultInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TemplateHashResultInner.java new file mode 100644 index 0000000000000..2ff71ee7e64ab --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/TemplateHashResultInner.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.resources.generated.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; + +/** Result of the request to calculate template hash. It contains a string of minified template and its hash. */ +@Fluent +public final class TemplateHashResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TemplateHashResultInner.class); + + /* + * The minified template string. + */ + @JsonProperty(value = "minifiedTemplate") + private String minifiedTemplate; + + /* + * The template hash. + */ + @JsonProperty(value = "templateHash") + private String templateHash; + + /** + * Get the minifiedTemplate property: The minified template string. + * + * @return the minifiedTemplate value. + */ + public String minifiedTemplate() { + return this.minifiedTemplate; + } + + /** + * Set the minifiedTemplate property: The minified template string. + * + * @param minifiedTemplate the minifiedTemplate value to set. + * @return the TemplateHashResultInner object itself. + */ + public TemplateHashResultInner withMinifiedTemplate(String minifiedTemplate) { + this.minifiedTemplate = minifiedTemplate; + return this; + } + + /** + * Get the templateHash property: The template hash. + * + * @return the templateHash value. + */ + public String templateHash() { + return this.templateHash; + } + + /** + * Set the templateHash property: The template hash. + * + * @param templateHash the templateHash value to set. + * @return the TemplateHashResultInner object itself. + */ + public TemplateHashResultInner withTemplateHash(String templateHash) { + this.templateHash = templateHash; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/WhatIfOperationProperties.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/WhatIfOperationProperties.java new file mode 100644 index 0000000000000..6cb699f445f48 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/WhatIfOperationProperties.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.WhatIfChange; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Deployment operation properties. */ +@Fluent +public final class WhatIfOperationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WhatIfOperationProperties.class); + + /* + * List of resource changes predicted by What-If operation. + */ + @JsonProperty(value = "changes") + private List changes; + + /** + * Get the changes property: List of resource changes predicted by What-If operation. + * + * @return the changes value. + */ + public List changes() { + return this.changes; + } + + /** + * Set the changes property: List of resource changes predicted by What-If operation. + * + * @param changes the changes value to set. + * @return the WhatIfOperationProperties object itself. + */ + public WhatIfOperationProperties withChanges(List changes) { + this.changes = changes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (changes() != null) { + changes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/WhatIfOperationResultInner.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/WhatIfOperationResultInner.java new file mode 100644 index 0000000000000..00439a18e687c --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/WhatIfOperationResultInner.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.models.WhatIfChange; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of + * results. + */ +@Fluent +public final class WhatIfOperationResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WhatIfOperationResultInner.class); + + /* + * Status of the What-If operation. + */ + @JsonProperty(value = "status") + private String status; + + /* + * What-If operation properties. + */ + @JsonProperty(value = "properties") + private WhatIfOperationProperties innerProperties; + + /* + * Error Response Error when What-If operation fails. + */ + @JsonProperty(value = "error") + private ManagementError error; + + /** + * Get the status property: Status of the What-If operation. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: Status of the What-If operation. + * + * @param status the status value to set. + * @return the WhatIfOperationResultInner object itself. + */ + public WhatIfOperationResultInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the innerProperties property: What-If operation properties. + * + * @return the innerProperties value. + */ + private WhatIfOperationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the error property: Error Response Error when What-If operation fails. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: Error Response Error when What-If operation fails. + * + * @param error the error value to set. + * @return the WhatIfOperationResultInner object itself. + */ + public WhatIfOperationResultInner withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Get the changes property: List of resource changes predicted by What-If operation. + * + * @return the changes value. + */ + public List changes() { + return this.innerProperties() == null ? null : this.innerProperties().changes(); + } + + /** + * Set the changes property: List of resource changes predicted by What-If operation. + * + * @param changes the changes value to set. + * @return the WhatIfOperationResultInner object itself. + */ + public WhatIfOperationResultInner withChanges(List changes) { + if (this.innerProperties() == null) { + this.innerProperties = new WhatIfOperationProperties(); + } + this.innerProperties().withChanges(changes); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/package-info.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/package-info.java new file mode 100644 index 0000000000000..cf72c3ef077ed --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for ResourceManagementClient. Provides operations for working with resources + * and resource groups. + */ +package com.azure.resourcemanager.resources.generated.fluent.models; diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/package-info.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/package-info.java new file mode 100644 index 0000000000000..1d259c694411d --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for ResourceManagementClient. Provides operations for working with resources + * and resource groups. + */ +package com.azure.resourcemanager.resources.generated.fluent; diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentExportResultImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentExportResultImpl.java new file mode 100644 index 0000000000000..a38b34c45ae86 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentExportResultImpl.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.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExportResultInner; +import com.azure.resourcemanager.resources.generated.models.DeploymentExportResult; + +public final class DeploymentExportResultImpl implements DeploymentExportResult { + private DeploymentExportResultInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + DeploymentExportResultImpl( + DeploymentExportResultInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Object template() { + return this.innerModel().template(); + } + + public DeploymentExportResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentExtendedImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentExtendedImpl.java new file mode 100644 index 0000000000000..f820a90198896 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentExtendedImpl.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExtendedInner; +import com.azure.resourcemanager.resources.generated.models.Deployment; +import com.azure.resourcemanager.resources.generated.models.DeploymentExportResult; +import com.azure.resourcemanager.resources.generated.models.DeploymentExtended; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.DeploymentPropertiesExtended; +import com.azure.resourcemanager.resources.generated.models.DeploymentValidateResult; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.WhatIfOperationResult; +import java.util.Collections; +import java.util.Map; + +public final class DeploymentExtendedImpl + implements DeploymentExtended, DeploymentExtended.Definition, DeploymentExtended.Update { + private DeploymentExtendedInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public DeploymentPropertiesExtended properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DeploymentExtendedInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String deploymentName; + + private Deployment createParameters; + + private Deployment updateParameters; + + public DeploymentExtendedImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DeploymentExtended create() { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .createOrUpdate(resourceGroupName, deploymentName, createParameters, Context.NONE); + return this; + } + + public DeploymentExtended create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .createOrUpdate(resourceGroupName, deploymentName, createParameters, context); + return this; + } + + DeploymentExtendedImpl(String name, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = new DeploymentExtendedInner(); + this.serviceManager = serviceManager; + this.deploymentName = name; + this.createParameters = new Deployment(); + } + + public DeploymentExtendedImpl update() { + this.updateParameters = new Deployment(); + return this; + } + + public DeploymentExtended apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .createOrUpdate(resourceGroupName, deploymentName, updateParameters, Context.NONE); + return this; + } + + public DeploymentExtended apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .createOrUpdate(resourceGroupName, deploymentName, updateParameters, context); + return this; + } + + DeploymentExtendedImpl( + DeploymentExtendedInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.deploymentName = Utils.getValueFromIdByName(innerObject.id(), "deployments"); + } + + public DeploymentExtended refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .getByResourceGroupWithResponse(resourceGroupName, deploymentName, Context.NONE) + .getValue(); + return this; + } + + public DeploymentExtended refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .getByResourceGroupWithResponse(resourceGroupName, deploymentName, context) + .getValue(); + return this; + } + + public void cancel() { + serviceManager.deployments().cancel(resourceGroupName, deploymentName); + } + + public Response cancelWithResponse(Context context) { + return serviceManager.deployments().cancelWithResponse(resourceGroupName, deploymentName, context); + } + + public DeploymentValidateResult validate(Deployment parameters) { + return serviceManager.deployments().validate(resourceGroupName, deploymentName, parameters); + } + + public DeploymentValidateResult validate(Deployment parameters, Context context) { + return serviceManager.deployments().validate(resourceGroupName, deploymentName, parameters, context); + } + + public WhatIfOperationResult whatIf(DeploymentWhatIf parameters) { + return serviceManager.deployments().whatIf(resourceGroupName, deploymentName, parameters); + } + + public WhatIfOperationResult whatIf(DeploymentWhatIf parameters, Context context) { + return serviceManager.deployments().whatIf(resourceGroupName, deploymentName, parameters, context); + } + + public DeploymentExportResult exportTemplate() { + return serviceManager.deployments().exportTemplate(resourceGroupName, deploymentName); + } + + public Response exportTemplateWithResponse(Context context) { + return serviceManager.deployments().exportTemplateWithResponse(resourceGroupName, deploymentName, context); + } + + public DeploymentExtendedImpl withProperties(DeploymentProperties properties) { + if (isInCreateMode()) { + this.createParameters.withProperties(properties); + return this; + } else { + this.updateParameters.withProperties(properties); + return this; + } + } + + public DeploymentExtendedImpl withRegion(Region location) { + this.createParameters.withLocation(location.toString()); + return this; + } + + public DeploymentExtendedImpl withRegion(String location) { + this.createParameters.withLocation(location); + return this; + } + + public DeploymentExtendedImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createParameters.withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentOperationImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentOperationImpl.java new file mode 100644 index 0000000000000..be148521a7951 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentOperationImpl.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.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentOperationInner; +import com.azure.resourcemanager.resources.generated.models.DeploymentOperation; +import com.azure.resourcemanager.resources.generated.models.DeploymentOperationProperties; + +public final class DeploymentOperationImpl implements DeploymentOperation { + private DeploymentOperationInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + DeploymentOperationImpl( + DeploymentOperationInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String operationId() { + return this.innerModel().operationId(); + } + + public DeploymentOperationProperties properties() { + return this.innerModel().properties(); + } + + public DeploymentOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentOperationsClientImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentOperationsClientImpl.java new file mode 100644 index 0000000000000..32f3f034efe61 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentOperationsClientImpl.java @@ -0,0 +1,2294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.DeploymentOperationsClient; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentOperationInner; +import com.azure.resourcemanager.resources.generated.models.DeploymentOperationsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DeploymentOperationsClient. */ +public final class DeploymentOperationsClientImpl implements DeploymentOperationsClient { + private final ClientLogger logger = new ClientLogger(DeploymentOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DeploymentOperationsService service; + + /** The service client containing this operation class. */ + private final ResourceManagementClientImpl client; + + /** + * Initializes an instance of DeploymentOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeploymentOperationsClientImpl(ResourceManagementClientImpl client) { + this.service = + RestProxy + .create(DeploymentOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourceManagementClientDeploymentOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ResourceManagementCl") + private interface DeploymentOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("deploymentName") String deploymentName, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("deploymentName") String deploymentName, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtTenantScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Resources/deployments/{deploymentName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtTenantScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments" + + "/{deploymentName}/operations/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("deploymentName") String deploymentName, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments" + + "/{deploymentName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("deploymentName") String deploymentName, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations" + + "/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations" + + "/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("deploymentName") String deploymentName, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}" + + "/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtScopeNext( + @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> listAtTenantScopeNext( + @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> listAtManagementGroupScopeNext( + @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> listAtSubscriptionScopeNext( + @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> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a deployments operation. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtScopeWithResponseAsync( + String scope, String deploymentName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .getAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + operationId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployments operation. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtScopeWithResponseAsync( + String scope, String deploymentName, 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 (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .getAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + operationId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a deployments operation. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtScopeAsync(String scope, String deploymentName, String operationId) { + return getAtScopeWithResponseAsync(scope, deploymentName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentOperationInner getAtScope(String scope, String deploymentName, String operationId) { + return getAtScopeAsync(scope, deploymentName, operationId).block(); + } + + /** + * Gets a deployments operation. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtScopeWithResponse( + String scope, String deploymentName, String operationId, Context context) { + return getAtScopeWithResponseAsync(scope, deploymentName, operationId, context).block(); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtScopeSinglePageAsync( + String scope, String deploymentName, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + top, + 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 deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtScopeSinglePageAsync( + String scope, String deploymentName, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAtScope( + this.client.getEndpoint(), scope, deploymentName, top, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtScopeAsync(String scope, String deploymentName, Integer top) { + return new PagedFlux<>( + () -> listAtScopeSinglePageAsync(scope, deploymentName, top), + nextLink -> listAtScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtScopeAsync(String scope, String deploymentName) { + final Integer top = null; + return new PagedFlux<>( + () -> listAtScopeSinglePageAsync(scope, deploymentName, top), + nextLink -> listAtScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtScopeAsync( + String scope, String deploymentName, Integer top, Context context) { + return new PagedFlux<>( + () -> listAtScopeSinglePageAsync(scope, deploymentName, top, context), + nextLink -> listAtScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtScope(String scope, String deploymentName) { + final Integer top = null; + return new PagedIterable<>(listAtScopeAsync(scope, deploymentName, top)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtScope( + String scope, String deploymentName, Integer top, Context context) { + return new PagedIterable<>(listAtScopeAsync(scope, deploymentName, top, context)); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtTenantScopeWithResponseAsync( + String deploymentName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .getAtTenantScope( + this.client.getEndpoint(), + deploymentName, + operationId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtTenantScopeWithResponseAsync( + String deploymentName, 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 (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .getAtTenantScope( + this.client.getEndpoint(), deploymentName, operationId, this.client.getApiVersion(), accept, context); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtTenantScopeAsync(String deploymentName, String operationId) { + return getAtTenantScopeWithResponseAsync(deploymentName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentOperationInner getAtTenantScope(String deploymentName, String operationId) { + return getAtTenantScopeAsync(deploymentName, operationId).block(); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtTenantScopeWithResponse( + String deploymentName, String operationId, Context context) { + return getAtTenantScopeWithResponseAsync(deploymentName, operationId, context).block(); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeSinglePageAsync( + String deploymentName, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAtTenantScope( + this.client.getEndpoint(), + deploymentName, + top, + 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 deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeSinglePageAsync( + String deploymentName, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAtTenantScope( + this.client.getEndpoint(), deploymentName, top, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtTenantScopeAsync(String deploymentName, Integer top) { + return new PagedFlux<>( + () -> listAtTenantScopeSinglePageAsync(deploymentName, top), + nextLink -> listAtTenantScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtTenantScopeAsync(String deploymentName) { + final Integer top = null; + return new PagedFlux<>( + () -> listAtTenantScopeSinglePageAsync(deploymentName, top), + nextLink -> listAtTenantScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtTenantScopeAsync( + String deploymentName, Integer top, Context context) { + return new PagedFlux<>( + () -> listAtTenantScopeSinglePageAsync(deploymentName, top, context), + nextLink -> listAtTenantScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtTenantScope(String deploymentName) { + final Integer top = null; + return new PagedIterable<>(listAtTenantScopeAsync(deploymentName, top)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtTenantScope( + String deploymentName, Integer top, Context context) { + return new PagedIterable<>(listAtTenantScopeAsync(deploymentName, top, context)); + } + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .getAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + operationId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, 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 (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .getAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + operationId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtManagementGroupScopeAsync( + String groupId, String deploymentName, String operationId) { + return getAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentOperationInner getAtManagementGroupScope( + String groupId, String deploymentName, String operationId) { + return getAtManagementGroupScopeAsync(groupId, deploymentName, operationId).block(); + } + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, String operationId, Context context) { + return getAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, operationId, context).block(); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtManagementGroupScopeSinglePageAsync( + String groupId, String deploymentName, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + top, + 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 deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtManagementGroupScopeSinglePageAsync( + String groupId, String deploymentName, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAtManagementGroupScope( + this.client.getEndpoint(), groupId, deploymentName, top, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtManagementGroupScopeAsync( + String groupId, String deploymentName, Integer top) { + return new PagedFlux<>( + () -> listAtManagementGroupScopeSinglePageAsync(groupId, deploymentName, top), + nextLink -> listAtManagementGroupScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtManagementGroupScopeAsync(String groupId, String deploymentName) { + final Integer top = null; + return new PagedFlux<>( + () -> listAtManagementGroupScopeSinglePageAsync(groupId, deploymentName, top), + nextLink -> listAtManagementGroupScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtManagementGroupScopeAsync( + String groupId, String deploymentName, Integer top, Context context) { + return new PagedFlux<>( + () -> listAtManagementGroupScopeSinglePageAsync(groupId, deploymentName, top, context), + nextLink -> listAtManagementGroupScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtManagementGroupScope(String groupId, String deploymentName) { + final Integer top = null; + return new PagedIterable<>(listAtManagementGroupScopeAsync(groupId, deploymentName, top)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtManagementGroupScope( + String groupId, String deploymentName, Integer top, Context context) { + return new PagedIterable<>(listAtManagementGroupScopeAsync(groupId, deploymentName, top, context)); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtSubscriptionScopeWithResponseAsync( + String deploymentName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId 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 + .getAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + operationId, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtSubscriptionScopeWithResponseAsync( + String deploymentName, 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 (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId 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 + .getAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + operationId, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtSubscriptionScopeAsync(String deploymentName, String operationId) { + return getAtSubscriptionScopeWithResponseAsync(deploymentName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentOperationInner getAtSubscriptionScope(String deploymentName, String operationId) { + return getAtSubscriptionScopeAsync(deploymentName, operationId).block(); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtSubscriptionScopeWithResponse( + String deploymentName, String operationId, Context context) { + return getAtSubscriptionScopeWithResponseAsync(deploymentName, operationId, context).block(); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtSubscriptionScopeSinglePageAsync( + String deploymentName, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .listAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtSubscriptionScopeSinglePageAsync( + String deploymentName, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .listAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtSubscriptionScopeAsync(String deploymentName, Integer top) { + return new PagedFlux<>( + () -> listAtSubscriptionScopeSinglePageAsync(deploymentName, top), + nextLink -> listAtSubscriptionScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtSubscriptionScopeAsync(String deploymentName) { + final Integer top = null; + return new PagedFlux<>( + () -> listAtSubscriptionScopeSinglePageAsync(deploymentName, top), + nextLink -> listAtSubscriptionScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtSubscriptionScopeAsync( + String deploymentName, Integer top, Context context) { + return new PagedFlux<>( + () -> listAtSubscriptionScopeSinglePageAsync(deploymentName, top, context), + nextLink -> listAtSubscriptionScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtSubscriptionScope(String deploymentName) { + final Integer top = null; + return new PagedIterable<>(listAtSubscriptionScopeAsync(deploymentName, top)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtSubscriptionScope( + String deploymentName, Integer top, Context context) { + return new PagedIterable<>(listAtSubscriptionScopeAsync(deploymentName, top, context)); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String deploymentName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + operationId, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String deploymentName, 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + operationId, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String deploymentName, String operationId) { + return getWithResponseAsync(resourceGroupName, deploymentName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentOperationInner get(String resourceGroupName, String deploymentName, String operationId) { + return getAsync(resourceGroupName, deploymentName, operationId).block(); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String deploymentName, String operationId, Context context) { + return getWithResponseAsync(resourceGroupName, deploymentName, operationId, context).block(); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String deploymentName, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String deploymentName, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String deploymentName, Integer top) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String deploymentName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String deploymentName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName, top, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String deploymentName) { + final Integer top = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, deploymentName, top)); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String deploymentName, Integer top, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, deploymentName, top, 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 list of deployment operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtScopeNextSinglePageAsync(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.listAtScopeNext(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 list of deployment operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtScopeNextSinglePageAsync( + 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 + .listAtScopeNext(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 list of deployment operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeNextSinglePageAsync(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.listAtTenantScopeNext(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 list of deployment operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeNextSinglePageAsync( + 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 + .listAtTenantScopeNext(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 list of deployment operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtManagementGroupScopeNextSinglePageAsync( + 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.listAtManagementGroupScopeNext(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 list of deployment operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtManagementGroupScopeNextSinglePageAsync( + 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 + .listAtManagementGroupScopeNext(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 list of deployment operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtSubscriptionScopeNextSinglePageAsync(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.listAtSubscriptionScopeNext(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 list of deployment operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtSubscriptionScopeNextSinglePageAsync( + 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 + .listAtSubscriptionScopeNext(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 list of deployment operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of deployment operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentOperationsImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentOperationsImpl.java new file mode 100644 index 0000000000000..3bddcda8fdcd2 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentOperationsImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.DeploymentOperationsClient; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentOperationInner; +import com.azure.resourcemanager.resources.generated.models.DeploymentOperation; +import com.azure.resourcemanager.resources.generated.models.DeploymentOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DeploymentOperationsImpl implements DeploymentOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentOperationsImpl.class); + + private final DeploymentOperationsClient innerClient; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + public DeploymentOperationsImpl( + DeploymentOperationsClient innerClient, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DeploymentOperation getAtScope(String scope, String deploymentName, String operationId) { + DeploymentOperationInner inner = this.serviceClient().getAtScope(scope, deploymentName, operationId); + if (inner != null) { + return new DeploymentOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtScopeWithResponse( + String scope, String deploymentName, String operationId, Context context) { + Response inner = + this.serviceClient().getAtScopeWithResponse(scope, deploymentName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentOperationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listAtScope(String scope, String deploymentName) { + PagedIterable inner = this.serviceClient().listAtScope(scope, deploymentName); + return Utils.mapPage(inner, inner1 -> new DeploymentOperationImpl(inner1, this.manager())); + } + + public PagedIterable listAtScope( + String scope, String deploymentName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listAtScope(scope, deploymentName, top, context); + return Utils.mapPage(inner, inner1 -> new DeploymentOperationImpl(inner1, this.manager())); + } + + public DeploymentOperation getAtTenantScope(String deploymentName, String operationId) { + DeploymentOperationInner inner = this.serviceClient().getAtTenantScope(deploymentName, operationId); + if (inner != null) { + return new DeploymentOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtTenantScopeWithResponse( + String deploymentName, String operationId, Context context) { + Response inner = + this.serviceClient().getAtTenantScopeWithResponse(deploymentName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentOperationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listAtTenantScope(String deploymentName) { + PagedIterable inner = this.serviceClient().listAtTenantScope(deploymentName); + return Utils.mapPage(inner, inner1 -> new DeploymentOperationImpl(inner1, this.manager())); + } + + public PagedIterable listAtTenantScope(String deploymentName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listAtTenantScope(deploymentName, top, context); + return Utils.mapPage(inner, inner1 -> new DeploymentOperationImpl(inner1, this.manager())); + } + + public DeploymentOperation getAtManagementGroupScope(String groupId, String deploymentName, String operationId) { + DeploymentOperationInner inner = + this.serviceClient().getAtManagementGroupScope(groupId, deploymentName, operationId); + if (inner != null) { + return new DeploymentOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, String operationId, Context context) { + Response inner = + this.serviceClient().getAtManagementGroupScopeWithResponse(groupId, deploymentName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentOperationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listAtManagementGroupScope(String groupId, String deploymentName) { + PagedIterable inner = + this.serviceClient().listAtManagementGroupScope(groupId, deploymentName); + return Utils.mapPage(inner, inner1 -> new DeploymentOperationImpl(inner1, this.manager())); + } + + public PagedIterable listAtManagementGroupScope( + String groupId, String deploymentName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listAtManagementGroupScope(groupId, deploymentName, top, context); + return Utils.mapPage(inner, inner1 -> new DeploymentOperationImpl(inner1, this.manager())); + } + + public DeploymentOperation getAtSubscriptionScope(String deploymentName, String operationId) { + DeploymentOperationInner inner = this.serviceClient().getAtSubscriptionScope(deploymentName, operationId); + if (inner != null) { + return new DeploymentOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtSubscriptionScopeWithResponse( + String deploymentName, String operationId, Context context) { + Response inner = + this.serviceClient().getAtSubscriptionScopeWithResponse(deploymentName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentOperationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listAtSubscriptionScope(String deploymentName) { + PagedIterable inner = this.serviceClient().listAtSubscriptionScope(deploymentName); + return Utils.mapPage(inner, inner1 -> new DeploymentOperationImpl(inner1, this.manager())); + } + + public PagedIterable listAtSubscriptionScope( + String deploymentName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listAtSubscriptionScope(deploymentName, top, context); + return Utils.mapPage(inner, inner1 -> new DeploymentOperationImpl(inner1, this.manager())); + } + + public DeploymentOperation get(String resourceGroupName, String deploymentName, String operationId) { + DeploymentOperationInner inner = this.serviceClient().get(resourceGroupName, deploymentName, operationId); + if (inner != null) { + return new DeploymentOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String deploymentName, String operationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, deploymentName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentOperationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String deploymentName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, deploymentName); + return Utils.mapPage(inner, inner1 -> new DeploymentOperationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String deploymentName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, deploymentName, top, context); + return Utils.mapPage(inner, inner1 -> new DeploymentOperationImpl(inner1, this.manager())); + } + + private DeploymentOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentValidateResultImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentValidateResultImpl.java new file mode 100644 index 0000000000000..ebc7203fa569a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentValidateResultImpl.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.resources.generated.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentValidateResultInner; +import com.azure.resourcemanager.resources.generated.models.DeploymentPropertiesExtended; +import com.azure.resourcemanager.resources.generated.models.DeploymentValidateResult; + +public final class DeploymentValidateResultImpl implements DeploymentValidateResult { + private DeploymentValidateResultInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + DeploymentValidateResultImpl( + DeploymentValidateResultInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public DeploymentPropertiesExtended properties() { + return this.innerModel().properties(); + } + + public DeploymentValidateResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentsClientImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentsClientImpl.java new file mode 100644 index 0000000000000..2ebc37c46c00a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentsClientImpl.java @@ -0,0 +1,9669 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.Head; +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.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.resources.generated.fluent.DeploymentsClient; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExportResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExtendedInner; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentValidateResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.TemplateHashResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.WhatIfOperationResultInner; +import com.azure.resourcemanager.resources.generated.models.Deployment; +import com.azure.resourcemanager.resources.generated.models.DeploymentListResult; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.ScopedDeployment; +import com.azure.resourcemanager.resources.generated.models.ScopedDeploymentWhatIf; +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 DeploymentsClient. */ +public final class DeploymentsClientImpl implements DeploymentsClient { + private final ClientLogger logger = new ClientLogger(DeploymentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DeploymentsService service; + + /** The service client containing this operation class. */ + private final ResourceManagementClientImpl client; + + /** + * Initializes an instance of DeploymentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeploymentsClientImpl(ResourceManagementClientImpl client) { + this.service = + RestProxy.create(DeploymentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourceManagementClientDeployments to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ResourceManagementCl") + private interface DeploymentsService { + @Headers({"Content-Type: application/json"}) + @Delete("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Head("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({204, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkExistenceAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdateAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") Deployment parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + @ExpectedResponses({200, 202, 400}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validateAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") Deployment parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> exportTemplateAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Resources/deployments/") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteAtTenantScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Head("/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({204, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkExistenceAtTenantScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdateAtTenantScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScopedDeployment parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtTenantScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelAtTenantScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + @ExpectedResponses({200, 202, 400}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validateAtTenantScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScopedDeployment parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> whatIfAtTenantScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScopedDeploymentWhatIf parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> exportTemplateAtTenantScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Resources/deployments/") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtTenantScope( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments" + + "/{deploymentName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Head( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments" + + "/{deploymentName}") + @ExpectedResponses({204, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkExistenceAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments" + + "/{deploymentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdateAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScopedDeployment parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments" + + "/{deploymentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments" + + "/{deploymentName}/cancel") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments" + + "/{deploymentName}/validate") + @ExpectedResponses({200, 202, 400}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validateAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScopedDeployment parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments" + + "/{deploymentName}/whatIf") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> whatIfAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScopedDeploymentWhatIf parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments" + + "/{deploymentName}/exportTemplate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> exportTemplateAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Head("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({204, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkExistenceAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdateAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") Deployment parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + @ExpectedResponses({200, 202, 400}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validateAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") Deployment parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> whatIfAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") DeploymentWhatIf parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> exportTemplateAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources" + + "/deployments/{deploymentName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Head( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources" + + "/deployments/{deploymentName}") + @ExpectedResponses({204, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkExistence( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources" + + "/deployments/{deploymentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") Deployment parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources" + + "/deployments/{deploymentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources" + + "/deployments/{deploymentName}/cancel") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources" + + "/deployments/{deploymentName}/validate") + @ExpectedResponses({200, 202, 400}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") Deployment parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources" + + "/deployments/{deploymentName}/whatIf") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> whatIf( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") DeploymentWhatIf parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources" + + "/deployments/{deploymentName}/exportTemplate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> exportTemplate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources" + + "/deployments/") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Resources/calculateTemplateHash") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> calculateTemplateHash( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") Object template, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtScopeNext( + @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> listAtTenantScopeNext( + @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> listAtManagementGroupScopeNext( + @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> listAtSubscriptionScopeNext( + @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); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteAtScopeWithResponseAsync(String scope, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteAtScopeWithResponseAsync( + String scope, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteAtScope( + this.client.getEndpoint(), scope, deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAtScopeAsync(String scope, String deploymentName) { + Mono>> mono = deleteAtScopeWithResponseAsync(scope, deploymentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAtScopeAsync( + String scope, String deploymentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteAtScopeWithResponseAsync(scope, deploymentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteAtScope(String scope, String deploymentName) { + return beginDeleteAtScopeAsync(scope, deploymentName).getSyncPoller(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteAtScope(String scope, String deploymentName, Context context) { + return beginDeleteAtScopeAsync(scope, deploymentName, context).getSyncPoller(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtScopeAsync(String scope, String deploymentName) { + return beginDeleteAtScopeAsync(scope, deploymentName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtScopeAsync(String scope, String deploymentName, Context context) { + return beginDeleteAtScopeAsync(scope, deploymentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteAtScope(String scope, String deploymentName) { + deleteAtScopeAsync(scope, deploymentName).block(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deleteAtScope(String scope, String deploymentName, Context context) { + deleteAtScopeAsync(scope, deploymentName, context).block(); + } + + /** + * Checks whether the deployment exists. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceAtScopeWithResponseAsync(String scope, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkExistenceAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks whether the deployment exists. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceAtScopeWithResponseAsync( + String scope, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkExistenceAtScope( + this.client.getEndpoint(), scope, deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * Checks whether the deployment exists. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkExistenceAtScopeAsync(String scope, String deploymentName) { + return checkExistenceAtScopeWithResponseAsync(scope, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean checkExistenceAtScope(String scope, String deploymentName) { + Boolean value = checkExistenceAtScopeAsync(scope, deploymentName).block(); + if (value != null) { + return value; + } else { + throw logger.logExceptionAsError(new NullPointerException()); + } + } + + /** + * Checks whether the deployment exists. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkExistenceAtScopeWithResponse(String scope, String deploymentName, Context context) { + return checkExistenceAtScopeWithResponseAsync(scope, deploymentName, context).block(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtScopeWithResponseAsync( + String scope, String deploymentName, Deployment parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .createOrUpdateAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtScopeWithResponseAsync( + String scope, String deploymentName, Deployment parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .createOrUpdateAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentExtendedInner> beginCreateOrUpdateAtScopeAsync( + String scope, String deploymentName, Deployment parameters) { + Mono>> mono = + createOrUpdateAtScopeWithResponseAsync(scope, deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentExtendedInner.class, + DeploymentExtendedInner.class, + this.client.getContext()); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentExtendedInner> beginCreateOrUpdateAtScopeAsync( + String scope, String deploymentName, Deployment parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateAtScopeWithResponseAsync(scope, deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentExtendedInner.class, + DeploymentExtendedInner.class, + context); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtScope( + String scope, String deploymentName, Deployment parameters) { + return beginCreateOrUpdateAtScopeAsync(scope, deploymentName, parameters).getSyncPoller(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtScope( + String scope, String deploymentName, Deployment parameters, Context context) { + return beginCreateOrUpdateAtScopeAsync(scope, deploymentName, parameters, context).getSyncPoller(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtScopeAsync( + String scope, String deploymentName, Deployment parameters) { + return beginCreateOrUpdateAtScopeAsync(scope, deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtScopeAsync( + String scope, String deploymentName, Deployment parameters, Context context) { + return beginCreateOrUpdateAtScopeAsync(scope, deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner createOrUpdateAtScope(String scope, String deploymentName, Deployment parameters) { + return createOrUpdateAtScopeAsync(scope, deploymentName, parameters).block(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner createOrUpdateAtScope( + String scope, String deploymentName, Deployment parameters, Context context) { + return createOrUpdateAtScopeAsync(scope, deploymentName, parameters, context).block(); + } + + /** + * Gets a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtScopeWithResponseAsync(String scope, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtScopeWithResponseAsync( + String scope, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAtScope(this.client.getEndpoint(), scope, deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtScopeAsync(String scope, String deploymentName) { + return getAtScopeWithResponseAsync(scope, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner getAtScope(String scope, String deploymentName) { + return getAtScopeAsync(scope, deploymentName).block(); + } + + /** + * Gets a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtScopeWithResponse( + String scope, String deploymentName, Context context) { + return getAtScopeWithResponseAsync(scope, deploymentName, context).block(); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtScopeWithResponseAsync(String scope, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancelAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtScopeWithResponseAsync(String scope, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancelAtScope( + this.client.getEndpoint(), scope, deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAtScopeAsync(String scope, String deploymentName) { + return cancelAtScopeWithResponseAsync(scope, deploymentName).flatMap((Response res) -> Mono.empty()); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cancelAtScope(String scope, String deploymentName) { + cancelAtScopeAsync(scope, deploymentName).block(); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelAtScopeWithResponse(String scope, String deploymentName, Context context) { + return cancelAtScopeWithResponseAsync(scope, deploymentName, context).block(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateAtScopeWithResponseAsync( + String scope, String deploymentName, Deployment parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .validateAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateAtScopeWithResponseAsync( + String scope, String deploymentName, Deployment parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .validateAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentValidateResultInner> + beginValidateAtScopeAsync(String scope, String deploymentName, Deployment parameters) { + Mono>> mono = validateAtScopeWithResponseAsync(scope, deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentValidateResultInner.class, + DeploymentValidateResultInner.class, + this.client.getContext()); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentValidateResultInner> + beginValidateAtScopeAsync(String scope, String deploymentName, Deployment parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + validateAtScopeWithResponseAsync(scope, deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentValidateResultInner.class, + DeploymentValidateResultInner.class, + context); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentValidateResultInner> beginValidateAtScope( + String scope, String deploymentName, Deployment parameters) { + return beginValidateAtScopeAsync(scope, deploymentName, parameters).getSyncPoller(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentValidateResultInner> beginValidateAtScope( + String scope, String deploymentName, Deployment parameters, Context context) { + return beginValidateAtScopeAsync(scope, deploymentName, parameters, context).getSyncPoller(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAtScopeAsync( + String scope, String deploymentName, Deployment parameters) { + return beginValidateAtScopeAsync(scope, deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAtScopeAsync( + String scope, String deploymentName, Deployment parameters, Context context) { + return beginValidateAtScopeAsync(scope, deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentValidateResultInner validateAtScope(String scope, String deploymentName, Deployment parameters) { + return validateAtScopeAsync(scope, deploymentName, parameters).block(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentValidateResultInner validateAtScope( + String scope, String deploymentName, Deployment parameters, Context context) { + return validateAtScopeAsync(scope, deploymentName, parameters, context).block(); + } + + /** + * Exports the template used for specified deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportTemplateAtScopeWithResponseAsync( + String scope, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .exportTemplateAtScope( + this.client.getEndpoint(), + scope, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exports the template used for specified deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportTemplateAtScopeWithResponseAsync( + String scope, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .exportTemplateAtScope( + this.client.getEndpoint(), scope, deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * Exports the template used for specified deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportTemplateAtScopeAsync(String scope, String deploymentName) { + return exportTemplateAtScopeWithResponseAsync(scope, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExportResultInner exportTemplateAtScope(String scope, String deploymentName) { + return exportTemplateAtScopeAsync(scope, deploymentName).block(); + } + + /** + * Exports the template used for specified deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportTemplateAtScopeWithResponse( + String scope, String deploymentName, Context context) { + return exportTemplateAtScopeWithResponseAsync(scope, deploymentName, context).block(); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The resource scope. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments at the given scope along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtScopeSinglePageAsync( + String scope, String filter, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAtScope( + this.client.getEndpoint(), + scope, + filter, + top, + 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 the deployments at the given scope. + * + * @param scope The resource scope. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments at the given scope along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtScopeSinglePageAsync( + String scope, String filter, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAtScope(this.client.getEndpoint(), scope, filter, top, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The resource scope. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments at the given scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtScopeAsync(String scope, String filter, Integer top) { + return new PagedFlux<>( + () -> listAtScopeSinglePageAsync(scope, filter, top), nextLink -> listAtScopeNextSinglePageAsync(nextLink)); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The resource scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments at the given scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtScopeAsync(String scope) { + final String filter = null; + final Integer top = null; + return new PagedFlux<>( + () -> listAtScopeSinglePageAsync(scope, filter, top), nextLink -> listAtScopeNextSinglePageAsync(nextLink)); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The resource scope. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments at the given scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtScopeAsync( + String scope, String filter, Integer top, Context context) { + return new PagedFlux<>( + () -> listAtScopeSinglePageAsync(scope, filter, top, context), + nextLink -> listAtScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The resource scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments at the given scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtScope(String scope) { + final String filter = null; + final Integer top = null; + return new PagedIterable<>(listAtScopeAsync(scope, filter, top)); + } + + /** + * Get all the deployments at the given scope. + * + * @param scope The resource scope. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments at the given scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtScope( + String scope, String filter, Integer top, Context context) { + return new PagedIterable<>(listAtScopeAsync(scope, filter, top, context)); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteAtTenantScopeWithResponseAsync(String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteAtTenantScopeWithResponseAsync( + String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAtTenantScopeAsync(String deploymentName) { + Mono>> mono = deleteAtTenantScopeWithResponseAsync(deploymentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAtTenantScopeAsync(String deploymentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteAtTenantScopeWithResponseAsync(deploymentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteAtTenantScope(String deploymentName) { + return beginDeleteAtTenantScopeAsync(deploymentName).getSyncPoller(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteAtTenantScope(String deploymentName, Context context) { + return beginDeleteAtTenantScopeAsync(deploymentName, context).getSyncPoller(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtTenantScopeAsync(String deploymentName) { + return beginDeleteAtTenantScopeAsync(deploymentName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtTenantScopeAsync(String deploymentName, Context context) { + return beginDeleteAtTenantScopeAsync(deploymentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteAtTenantScope(String deploymentName) { + deleteAtTenantScopeAsync(deploymentName).block(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtTenantScope(String deploymentName, Context context) { + deleteAtTenantScopeAsync(deploymentName, context).block(); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceAtTenantScopeWithResponseAsync(String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkExistenceAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceAtTenantScopeWithResponseAsync( + String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkExistenceAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkExistenceAtTenantScopeAsync(String deploymentName) { + return checkExistenceAtTenantScopeWithResponseAsync(deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean checkExistenceAtTenantScope(String deploymentName) { + Boolean value = checkExistenceAtTenantScopeAsync(deploymentName).block(); + if (value != null) { + return value; + } else { + throw logger.logExceptionAsError(new NullPointerException()); + } + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkExistenceAtTenantScopeWithResponse(String deploymentName, Context context) { + return checkExistenceAtTenantScopeWithResponseAsync(deploymentName, context).block(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtTenantScopeWithResponseAsync( + String deploymentName, ScopedDeployment parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .createOrUpdateAtTenantScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtTenantScopeWithResponseAsync( + String deploymentName, ScopedDeployment parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .createOrUpdateAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentExtendedInner> + beginCreateOrUpdateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters) { + Mono>> mono = + createOrUpdateAtTenantScopeWithResponseAsync(deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentExtendedInner.class, + DeploymentExtendedInner.class, + this.client.getContext()); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentExtendedInner> + beginCreateOrUpdateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateAtTenantScopeWithResponseAsync(deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentExtendedInner.class, + DeploymentExtendedInner.class, + context); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtTenantScope( + String deploymentName, ScopedDeployment parameters) { + return beginCreateOrUpdateAtTenantScopeAsync(deploymentName, parameters).getSyncPoller(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentExtendedInner> beginCreateOrUpdateAtTenantScope( + String deploymentName, ScopedDeployment parameters, Context context) { + return beginCreateOrUpdateAtTenantScopeAsync(deploymentName, parameters, context).getSyncPoller(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtTenantScopeAsync( + String deploymentName, ScopedDeployment parameters) { + return beginCreateOrUpdateAtTenantScopeAsync(deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtTenantScopeAsync( + String deploymentName, ScopedDeployment parameters, Context context) { + return beginCreateOrUpdateAtTenantScopeAsync(deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner createOrUpdateAtTenantScope(String deploymentName, ScopedDeployment parameters) { + return createOrUpdateAtTenantScopeAsync(deploymentName, parameters).block(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner createOrUpdateAtTenantScope( + String deploymentName, ScopedDeployment parameters, Context context) { + return createOrUpdateAtTenantScopeAsync(deploymentName, parameters, context).block(); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtTenantScopeWithResponseAsync(String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtTenantScopeWithResponseAsync( + String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAtTenantScope(this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtTenantScopeAsync(String deploymentName) { + return getAtTenantScopeWithResponseAsync(deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner getAtTenantScope(String deploymentName) { + return getAtTenantScopeAsync(deploymentName).block(); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtTenantScopeWithResponse(String deploymentName, Context context) { + return getAtTenantScopeWithResponseAsync(deploymentName, context).block(); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtTenantScopeWithResponseAsync(String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancelAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtTenantScopeWithResponseAsync(String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancelAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAtTenantScopeAsync(String deploymentName) { + return cancelAtTenantScopeWithResponseAsync(deploymentName).flatMap((Response res) -> Mono.empty()); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cancelAtTenantScope(String deploymentName) { + cancelAtTenantScopeAsync(deploymentName).block(); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelAtTenantScopeWithResponse(String deploymentName, Context context) { + return cancelAtTenantScopeWithResponseAsync(deploymentName, context).block(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateAtTenantScopeWithResponseAsync( + String deploymentName, ScopedDeployment parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .validateAtTenantScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateAtTenantScopeWithResponseAsync( + String deploymentName, ScopedDeployment parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .validateAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentValidateResultInner> + beginValidateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters) { + Mono>> mono = validateAtTenantScopeWithResponseAsync(deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentValidateResultInner.class, + DeploymentValidateResultInner.class, + this.client.getContext()); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentValidateResultInner> + beginValidateAtTenantScopeAsync(String deploymentName, ScopedDeployment parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + validateAtTenantScopeWithResponseAsync(deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentValidateResultInner.class, + DeploymentValidateResultInner.class, + context); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentValidateResultInner> + beginValidateAtTenantScope(String deploymentName, ScopedDeployment parameters) { + return beginValidateAtTenantScopeAsync(deploymentName, parameters).getSyncPoller(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentValidateResultInner> + beginValidateAtTenantScope(String deploymentName, ScopedDeployment parameters, Context context) { + return beginValidateAtTenantScopeAsync(deploymentName, parameters, context).getSyncPoller(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAtTenantScopeAsync( + String deploymentName, ScopedDeployment parameters) { + return beginValidateAtTenantScopeAsync(deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAtTenantScopeAsync( + String deploymentName, ScopedDeployment parameters, Context context) { + return beginValidateAtTenantScopeAsync(deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentValidateResultInner validateAtTenantScope(String deploymentName, ScopedDeployment parameters) { + return validateAtTenantScopeAsync(deploymentName, parameters).block(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentValidateResultInner validateAtTenantScope( + String deploymentName, ScopedDeployment parameters, Context context) { + return validateAtTenantScopeAsync(deploymentName, parameters, context).block(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> whatIfAtTenantScopeWithResponseAsync( + String deploymentName, ScopedDeploymentWhatIf parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .whatIfAtTenantScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> whatIfAtTenantScopeWithResponseAsync( + String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .whatIfAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WhatIfOperationResultInner> + beginWhatIfAtTenantScopeAsync(String deploymentName, ScopedDeploymentWhatIf parameters) { + Mono>> mono = whatIfAtTenantScopeWithResponseAsync(deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WhatIfOperationResultInner.class, + WhatIfOperationResultInner.class, + this.client.getContext()); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WhatIfOperationResultInner> + beginWhatIfAtTenantScopeAsync(String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + whatIfAtTenantScopeWithResponseAsync(deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WhatIfOperationResultInner.class, + WhatIfOperationResultInner.class, + context); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WhatIfOperationResultInner> beginWhatIfAtTenantScope( + String deploymentName, ScopedDeploymentWhatIf parameters) { + return beginWhatIfAtTenantScopeAsync(deploymentName, parameters).getSyncPoller(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WhatIfOperationResultInner> beginWhatIfAtTenantScope( + String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + return beginWhatIfAtTenantScopeAsync(deploymentName, parameters, context).getSyncPoller(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono whatIfAtTenantScopeAsync( + String deploymentName, ScopedDeploymentWhatIf parameters) { + return beginWhatIfAtTenantScopeAsync(deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono whatIfAtTenantScopeAsync( + String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + return beginWhatIfAtTenantScopeAsync(deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WhatIfOperationResultInner whatIfAtTenantScope(String deploymentName, ScopedDeploymentWhatIf parameters) { + return whatIfAtTenantScopeAsync(deploymentName, parameters).block(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WhatIfOperationResultInner whatIfAtTenantScope( + String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + return whatIfAtTenantScopeAsync(deploymentName, parameters, context).block(); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportTemplateAtTenantScopeWithResponseAsync( + String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .exportTemplateAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportTemplateAtTenantScopeWithResponseAsync( + String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .exportTemplateAtTenantScope( + this.client.getEndpoint(), deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportTemplateAtTenantScopeAsync(String deploymentName) { + return exportTemplateAtTenantScopeWithResponseAsync(deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExportResultInner exportTemplateAtTenantScope(String deploymentName) { + return exportTemplateAtTenantScopeAsync(deploymentName).block(); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportTemplateAtTenantScopeWithResponse( + String deploymentName, Context context) { + return exportTemplateAtTenantScopeWithResponseAsync(deploymentName, context).block(); + } + + /** + * Get all the deployments at the tenant scope. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments at the tenant scope along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeSinglePageAsync(String filter, Integer top) { + 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 + .listAtTenantScope( + this.client.getEndpoint(), filter, top, 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 the deployments at the tenant scope. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments at the tenant scope along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeSinglePageAsync( + String filter, Integer top, 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 + .listAtTenantScope(this.client.getEndpoint(), filter, top, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all the deployments at the tenant scope. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments at the tenant scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtTenantScopeAsync(String filter, Integer top) { + return new PagedFlux<>( + () -> listAtTenantScopeSinglePageAsync(filter, top), + nextLink -> listAtTenantScopeNextSinglePageAsync(nextLink)); + } + + /** + * Get all the deployments at the tenant scope. + * + * @throws 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 the deployments at the tenant scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtTenantScopeAsync() { + final String filter = null; + final Integer top = null; + return new PagedFlux<>( + () -> listAtTenantScopeSinglePageAsync(filter, top), + nextLink -> listAtTenantScopeNextSinglePageAsync(nextLink)); + } + + /** + * Get all the deployments at the tenant scope. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments at the tenant scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtTenantScopeAsync(String filter, Integer top, Context context) { + return new PagedFlux<>( + () -> listAtTenantScopeSinglePageAsync(filter, top, context), + nextLink -> listAtTenantScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all the deployments at the tenant scope. + * + * @throws 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 the deployments at the tenant scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtTenantScope() { + final String filter = null; + final Integer top = null; + return new PagedIterable<>(listAtTenantScopeAsync(filter, top)); + } + + /** + * Get all the deployments at the tenant scope. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments at the tenant scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtTenantScope(String filter, Integer top, Context context) { + return new PagedIterable<>(listAtTenantScopeAsync(filter, top, context)); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteAtManagementGroupScope( + this.client.getEndpoint(), groupId, deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAtManagementGroupScopeAsync( + String groupId, String deploymentName) { + Mono>> mono = deleteAtManagementGroupScopeWithResponseAsync(groupId, deploymentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAtManagementGroupScopeAsync( + String groupId, String deploymentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteAtManagementGroupScope(String groupId, String deploymentName) { + return beginDeleteAtManagementGroupScopeAsync(groupId, deploymentName).getSyncPoller(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteAtManagementGroupScope( + String groupId, String deploymentName, Context context) { + return beginDeleteAtManagementGroupScopeAsync(groupId, deploymentName, context).getSyncPoller(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtManagementGroupScopeAsync(String groupId, String deploymentName) { + return beginDeleteAtManagementGroupScopeAsync(groupId, deploymentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtManagementGroupScopeAsync(String groupId, String deploymentName, Context context) { + return beginDeleteAtManagementGroupScopeAsync(groupId, deploymentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteAtManagementGroupScope(String groupId, String deploymentName) { + deleteAtManagementGroupScopeAsync(groupId, deploymentName).block(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deleteAtManagementGroupScope(String groupId, String deploymentName, Context context) { + deleteAtManagementGroupScopeAsync(groupId, deploymentName, context).block(); + } + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkExistenceAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkExistenceAtManagementGroupScope( + this.client.getEndpoint(), groupId, deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkExistenceAtManagementGroupScopeAsync(String groupId, String deploymentName) { + return checkExistenceAtManagementGroupScopeWithResponseAsync(groupId, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean checkExistenceAtManagementGroupScope(String groupId, String deploymentName) { + Boolean value = checkExistenceAtManagementGroupScopeAsync(groupId, deploymentName).block(); + if (value != null) { + return value; + } else { + throw logger.logExceptionAsError(new NullPointerException()); + } + } + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkExistenceAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context) { + return checkExistenceAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, context).block(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, ScopedDeployment parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .createOrUpdateAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .createOrUpdateAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentExtendedInner> + beginCreateOrUpdateAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeployment parameters) { + Mono>> mono = + createOrUpdateAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentExtendedInner.class, + DeploymentExtendedInner.class, + this.client.getContext()); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentExtendedInner> + beginCreateOrUpdateAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentExtendedInner.class, + DeploymentExtendedInner.class, + context); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentExtendedInner> + beginCreateOrUpdateAtManagementGroupScope(String groupId, String deploymentName, ScopedDeployment parameters) { + return beginCreateOrUpdateAtManagementGroupScopeAsync(groupId, deploymentName, parameters).getSyncPoller(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentExtendedInner> + beginCreateOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + return beginCreateOrUpdateAtManagementGroupScopeAsync(groupId, deploymentName, parameters, context) + .getSyncPoller(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeployment parameters) { + return beginCreateOrUpdateAtManagementGroupScopeAsync(groupId, deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + return beginCreateOrUpdateAtManagementGroupScopeAsync(groupId, deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner createOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters) { + return createOrUpdateAtManagementGroupScopeAsync(groupId, deploymentName, parameters).block(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner createOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + return createOrUpdateAtManagementGroupScopeAsync(groupId, deploymentName, parameters, context).block(); + } + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAtManagementGroupScope( + this.client.getEndpoint(), groupId, deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtManagementGroupScopeAsync(String groupId, String deploymentName) { + return getAtManagementGroupScopeWithResponseAsync(groupId, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner getAtManagementGroupScope(String groupId, String deploymentName) { + return getAtManagementGroupScopeAsync(groupId, deploymentName).block(); + } + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context) { + return getAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, context).block(); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtManagementGroupScopeWithResponseAsync(String groupId, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancelAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancelAtManagementGroupScope( + this.client.getEndpoint(), groupId, deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAtManagementGroupScopeAsync(String groupId, String deploymentName) { + return cancelAtManagementGroupScopeWithResponseAsync(groupId, deploymentName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cancelAtManagementGroupScope(String groupId, String deploymentName) { + cancelAtManagementGroupScopeAsync(groupId, deploymentName).block(); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context) { + return cancelAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, context).block(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, ScopedDeployment parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .validateAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .validateAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentValidateResultInner> + beginValidateAtManagementGroupScopeAsync(String groupId, String deploymentName, ScopedDeployment parameters) { + Mono>> mono = + validateAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentValidateResultInner.class, + DeploymentValidateResultInner.class, + this.client.getContext()); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentValidateResultInner> + beginValidateAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + validateAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentValidateResultInner.class, + DeploymentValidateResultInner.class, + context); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentValidateResultInner> + beginValidateAtManagementGroupScope(String groupId, String deploymentName, ScopedDeployment parameters) { + return beginValidateAtManagementGroupScopeAsync(groupId, deploymentName, parameters).getSyncPoller(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentValidateResultInner> + beginValidateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + return beginValidateAtManagementGroupScopeAsync(groupId, deploymentName, parameters, context).getSyncPoller(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeployment parameters) { + return beginValidateAtManagementGroupScopeAsync(groupId, deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + return beginValidateAtManagementGroupScopeAsync(groupId, deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentValidateResultInner validateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters) { + return validateAtManagementGroupScopeAsync(groupId, deploymentName, parameters).block(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentValidateResultInner validateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + return validateAtManagementGroupScopeAsync(groupId, deploymentName, parameters, context).block(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> whatIfAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .whatIfAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> whatIfAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .whatIfAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WhatIfOperationResultInner> + beginWhatIfAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters) { + Mono>> mono = + whatIfAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WhatIfOperationResultInner.class, + WhatIfOperationResultInner.class, + this.client.getContext()); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WhatIfOperationResultInner> + beginWhatIfAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + whatIfAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WhatIfOperationResultInner.class, + WhatIfOperationResultInner.class, + context); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WhatIfOperationResultInner> + beginWhatIfAtManagementGroupScope(String groupId, String deploymentName, ScopedDeploymentWhatIf parameters) { + return beginWhatIfAtManagementGroupScopeAsync(groupId, deploymentName, parameters).getSyncPoller(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WhatIfOperationResultInner> + beginWhatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + return beginWhatIfAtManagementGroupScopeAsync(groupId, deploymentName, parameters, context).getSyncPoller(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono whatIfAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters) { + return beginWhatIfAtManagementGroupScopeAsync(groupId, deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono whatIfAtManagementGroupScopeAsync( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + return beginWhatIfAtManagementGroupScopeAsync(groupId, deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WhatIfOperationResultInner whatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters) { + return whatIfAtManagementGroupScopeAsync(groupId, deploymentName, parameters).block(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WhatIfOperationResultInner whatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + return whatIfAtManagementGroupScopeAsync(groupId, deploymentName, parameters, context).block(); + } + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportTemplateAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .exportTemplateAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportTemplateAtManagementGroupScopeWithResponseAsync( + String groupId, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .exportTemplateAtManagementGroupScope( + this.client.getEndpoint(), groupId, deploymentName, this.client.getApiVersion(), accept, context); + } + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportTemplateAtManagementGroupScopeAsync( + String groupId, String deploymentName) { + return exportTemplateAtManagementGroupScopeWithResponseAsync(groupId, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExportResultInner exportTemplateAtManagementGroupScope(String groupId, String deploymentName) { + return exportTemplateAtManagementGroupScopeAsync(groupId, deploymentName).block(); + } + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportTemplateAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context) { + return exportTemplateAtManagementGroupScopeWithResponseAsync(groupId, deploymentName, context).block(); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments for a management group along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtManagementGroupScopeSinglePageAsync( + String groupId, String filter, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAtManagementGroupScope( + this.client.getEndpoint(), + groupId, + filter, + top, + 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 the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a management group along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtManagementGroupScopeSinglePageAsync( + String groupId, String filter, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAtManagementGroupScope( + this.client.getEndpoint(), groupId, filter, top, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments for a management group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtManagementGroupScopeAsync( + String groupId, String filter, Integer top) { + return new PagedFlux<>( + () -> listAtManagementGroupScopeSinglePageAsync(groupId, filter, top), + nextLink -> listAtManagementGroupScopeNextSinglePageAsync(nextLink)); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments for a management group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtManagementGroupScopeAsync(String groupId) { + final String filter = null; + final Integer top = null; + return new PagedFlux<>( + () -> listAtManagementGroupScopeSinglePageAsync(groupId, filter, top), + nextLink -> listAtManagementGroupScopeNextSinglePageAsync(nextLink)); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a management group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtManagementGroupScopeAsync( + String groupId, String filter, Integer top, Context context) { + return new PagedFlux<>( + () -> listAtManagementGroupScopeSinglePageAsync(groupId, filter, top, context), + nextLink -> listAtManagementGroupScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments for a management group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtManagementGroupScope(String groupId) { + final String filter = null; + final Integer top = null; + return new PagedIterable<>(listAtManagementGroupScopeAsync(groupId, filter, top)); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a management group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtManagementGroupScope( + String groupId, String filter, Integer top, Context context) { + return new PagedIterable<>(listAtManagementGroupScopeAsync(groupId, filter, top, context)); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteAtSubscriptionScopeWithResponseAsync(String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .deleteAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteAtSubscriptionScopeWithResponseAsync( + String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .deleteAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAtSubscriptionScopeAsync(String deploymentName) { + Mono>> mono = deleteAtSubscriptionScopeWithResponseAsync(deploymentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAtSubscriptionScopeAsync( + String deploymentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteAtSubscriptionScopeWithResponseAsync(deploymentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteAtSubscriptionScope(String deploymentName) { + return beginDeleteAtSubscriptionScopeAsync(deploymentName).getSyncPoller(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteAtSubscriptionScope(String deploymentName, Context context) { + return beginDeleteAtSubscriptionScopeAsync(deploymentName, context).getSyncPoller(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtSubscriptionScopeAsync(String deploymentName) { + return beginDeleteAtSubscriptionScopeAsync(deploymentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtSubscriptionScopeAsync(String deploymentName, Context context) { + return beginDeleteAtSubscriptionScopeAsync(deploymentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteAtSubscriptionScope(String deploymentName) { + deleteAtSubscriptionScopeAsync(deploymentName).block(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtSubscriptionScope(String deploymentName, Context context) { + deleteAtSubscriptionScopeAsync(deploymentName, context).block(); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceAtSubscriptionScopeWithResponseAsync(String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .checkExistenceAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceAtSubscriptionScopeWithResponseAsync( + String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .checkExistenceAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkExistenceAtSubscriptionScopeAsync(String deploymentName) { + return checkExistenceAtSubscriptionScopeWithResponseAsync(deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean checkExistenceAtSubscriptionScope(String deploymentName) { + Boolean value = checkExistenceAtSubscriptionScopeAsync(deploymentName).block(); + if (value != null) { + return value; + } else { + throw logger.logExceptionAsError(new NullPointerException()); + } + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkExistenceAtSubscriptionScopeWithResponse(String deploymentName, Context context) { + return checkExistenceAtSubscriptionScopeWithResponseAsync(deploymentName, context).block(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtSubscriptionScopeWithResponseAsync( + String deploymentName, Deployment parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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 + .createOrUpdateAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtSubscriptionScopeWithResponseAsync( + String deploymentName, Deployment parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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 + .createOrUpdateAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentExtendedInner> + beginCreateOrUpdateAtSubscriptionScopeAsync(String deploymentName, Deployment parameters) { + Mono>> mono = + createOrUpdateAtSubscriptionScopeWithResponseAsync(deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentExtendedInner.class, + DeploymentExtendedInner.class, + this.client.getContext()); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentExtendedInner> + beginCreateOrUpdateAtSubscriptionScopeAsync(String deploymentName, Deployment parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateAtSubscriptionScopeWithResponseAsync(deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentExtendedInner.class, + DeploymentExtendedInner.class, + context); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentExtendedInner> + beginCreateOrUpdateAtSubscriptionScope(String deploymentName, Deployment parameters) { + return beginCreateOrUpdateAtSubscriptionScopeAsync(deploymentName, parameters).getSyncPoller(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentExtendedInner> + beginCreateOrUpdateAtSubscriptionScope(String deploymentName, Deployment parameters, Context context) { + return beginCreateOrUpdateAtSubscriptionScopeAsync(deploymentName, parameters, context).getSyncPoller(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtSubscriptionScopeAsync( + String deploymentName, Deployment parameters) { + return beginCreateOrUpdateAtSubscriptionScopeAsync(deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtSubscriptionScopeAsync( + String deploymentName, Deployment parameters, Context context) { + return beginCreateOrUpdateAtSubscriptionScopeAsync(deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner createOrUpdateAtSubscriptionScope(String deploymentName, Deployment parameters) { + return createOrUpdateAtSubscriptionScopeAsync(deploymentName, parameters).block(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner createOrUpdateAtSubscriptionScope( + String deploymentName, Deployment parameters, Context context) { + return createOrUpdateAtSubscriptionScopeAsync(deploymentName, parameters, context).block(); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtSubscriptionScopeWithResponseAsync(String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .getAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtSubscriptionScopeWithResponseAsync( + String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .getAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtSubscriptionScopeAsync(String deploymentName) { + return getAtSubscriptionScopeWithResponseAsync(deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner getAtSubscriptionScope(String deploymentName) { + return getAtSubscriptionScopeAsync(deploymentName).block(); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtSubscriptionScopeWithResponse( + String deploymentName, Context context) { + return getAtSubscriptionScopeWithResponseAsync(deploymentName, context).block(); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtSubscriptionScopeWithResponseAsync(String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .cancelAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtSubscriptionScopeWithResponseAsync(String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .cancelAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAtSubscriptionScopeAsync(String deploymentName) { + return cancelAtSubscriptionScopeWithResponseAsync(deploymentName).flatMap((Response res) -> Mono.empty()); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cancelAtSubscriptionScope(String deploymentName) { + cancelAtSubscriptionScopeAsync(deploymentName).block(); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelAtSubscriptionScopeWithResponse(String deploymentName, Context context) { + return cancelAtSubscriptionScopeWithResponseAsync(deploymentName, context).block(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateAtSubscriptionScopeWithResponseAsync( + String deploymentName, Deployment parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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 + .validateAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateAtSubscriptionScopeWithResponseAsync( + String deploymentName, Deployment parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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 + .validateAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentValidateResultInner> + beginValidateAtSubscriptionScopeAsync(String deploymentName, Deployment parameters) { + Mono>> mono = + validateAtSubscriptionScopeWithResponseAsync(deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentValidateResultInner.class, + DeploymentValidateResultInner.class, + this.client.getContext()); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentValidateResultInner> + beginValidateAtSubscriptionScopeAsync(String deploymentName, Deployment parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + validateAtSubscriptionScopeWithResponseAsync(deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentValidateResultInner.class, + DeploymentValidateResultInner.class, + context); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentValidateResultInner> + beginValidateAtSubscriptionScope(String deploymentName, Deployment parameters) { + return beginValidateAtSubscriptionScopeAsync(deploymentName, parameters).getSyncPoller(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentValidateResultInner> + beginValidateAtSubscriptionScope(String deploymentName, Deployment parameters, Context context) { + return beginValidateAtSubscriptionScopeAsync(deploymentName, parameters, context).getSyncPoller(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAtSubscriptionScopeAsync( + String deploymentName, Deployment parameters) { + return beginValidateAtSubscriptionScopeAsync(deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAtSubscriptionScopeAsync( + String deploymentName, Deployment parameters, Context context) { + return beginValidateAtSubscriptionScopeAsync(deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentValidateResultInner validateAtSubscriptionScope(String deploymentName, Deployment parameters) { + return validateAtSubscriptionScopeAsync(deploymentName, parameters).block(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentValidateResultInner validateAtSubscriptionScope( + String deploymentName, Deployment parameters, Context context) { + return validateAtSubscriptionScopeAsync(deploymentName, parameters, context).block(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> whatIfAtSubscriptionScopeWithResponseAsync( + String deploymentName, DeploymentWhatIf parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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 + .whatIfAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 result of the What-If operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> whatIfAtSubscriptionScopeWithResponseAsync( + String deploymentName, DeploymentWhatIf parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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 + .whatIfAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WhatIfOperationResultInner> + beginWhatIfAtSubscriptionScopeAsync(String deploymentName, DeploymentWhatIf parameters) { + Mono>> mono = whatIfAtSubscriptionScopeWithResponseAsync(deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WhatIfOperationResultInner.class, + WhatIfOperationResultInner.class, + this.client.getContext()); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WhatIfOperationResultInner> + beginWhatIfAtSubscriptionScopeAsync(String deploymentName, DeploymentWhatIf parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + whatIfAtSubscriptionScopeWithResponseAsync(deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WhatIfOperationResultInner.class, + WhatIfOperationResultInner.class, + context); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WhatIfOperationResultInner> + beginWhatIfAtSubscriptionScope(String deploymentName, DeploymentWhatIf parameters) { + return beginWhatIfAtSubscriptionScopeAsync(deploymentName, parameters).getSyncPoller(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WhatIfOperationResultInner> + beginWhatIfAtSubscriptionScope(String deploymentName, DeploymentWhatIf parameters, Context context) { + return beginWhatIfAtSubscriptionScopeAsync(deploymentName, parameters, context).getSyncPoller(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono whatIfAtSubscriptionScopeAsync( + String deploymentName, DeploymentWhatIf parameters) { + return beginWhatIfAtSubscriptionScopeAsync(deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 result of the What-If operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono whatIfAtSubscriptionScopeAsync( + String deploymentName, DeploymentWhatIf parameters, Context context) { + return beginWhatIfAtSubscriptionScopeAsync(deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WhatIfOperationResultInner whatIfAtSubscriptionScope(String deploymentName, DeploymentWhatIf parameters) { + return whatIfAtSubscriptionScopeAsync(deploymentName, parameters).block(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WhatIfOperationResultInner whatIfAtSubscriptionScope( + String deploymentName, DeploymentWhatIf parameters, Context context) { + return whatIfAtSubscriptionScopeAsync(deploymentName, parameters, context).block(); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportTemplateAtSubscriptionScopeWithResponseAsync( + String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .exportTemplateAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportTemplateAtSubscriptionScopeWithResponseAsync( + String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .exportTemplateAtSubscriptionScope( + this.client.getEndpoint(), + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportTemplateAtSubscriptionScopeAsync(String deploymentName) { + return exportTemplateAtSubscriptionScopeWithResponseAsync(deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExportResultInner exportTemplateAtSubscriptionScope(String deploymentName) { + return exportTemplateAtSubscriptionScopeAsync(deploymentName).block(); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportTemplateAtSubscriptionScopeWithResponse( + String deploymentName, Context context) { + return exportTemplateAtSubscriptionScopeWithResponseAsync(deploymentName, context).block(); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments for a subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Integer top) { + 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(), + filter, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String filter, Integer top, 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(), + filter, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments for a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Integer top) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, top), nextLink -> listAtSubscriptionScopeNextSinglePageAsync(nextLink)); + } + + /** + * Get all the deployments for a 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 all the deployments for a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + final Integer top = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter, top), nextLink -> listAtSubscriptionScopeNextSinglePageAsync(nextLink)); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, top, context), + nextLink -> listAtSubscriptionScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all the deployments for a 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 all the deployments for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + final Integer top = null; + return new PagedIterable<>(listAsync(filter, top)); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Integer top, Context context) { + return new PagedIterable<>(listAsync(filter, top, context)); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String deploymentName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, deploymentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String deploymentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, deploymentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String deploymentName) { + return beginDeleteAsync(resourceGroupName, deploymentName).getSyncPoller(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String deploymentName, Context context) { + return beginDeleteAsync(resourceGroupName, deploymentName, context).getSyncPoller(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String deploymentName) { + return beginDeleteAsync(resourceGroupName, deploymentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String deploymentName, Context context) { + return beginDeleteAsync(resourceGroupName, deploymentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deploymentName) { + deleteAsync(resourceGroupName, deploymentName).block(); + } + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 deploymentName, Context context) { + deleteAsync(resourceGroupName, deploymentName, context).block(); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceWithResponseAsync(String resourceGroupName, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .checkExistence( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceWithResponseAsync( + String resourceGroupName, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .checkExistence( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkExistenceAsync(String resourceGroupName, String deploymentName) { + return checkExistenceWithResponseAsync(resourceGroupName, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean checkExistence(String resourceGroupName, String deploymentName) { + Boolean value = checkExistenceAsync(resourceGroupName, deploymentName).block(); + if (value != null) { + return value; + } else { + throw logger.logExceptionAsError(new NullPointerException()); + } + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkExistenceWithResponse( + String resourceGroupName, String deploymentName, Context context) { + return checkExistenceWithResponseAsync(resourceGroupName, deploymentName, context).block(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String deploymentName, Deployment parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentExtendedInner> beginCreateOrUpdateAsync( + String resourceGroupName, String deploymentName, Deployment parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentExtendedInner.class, + DeploymentExtendedInner.class, + this.client.getContext()); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentExtendedInner> beginCreateOrUpdateAsync( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentExtendedInner.class, + DeploymentExtendedInner.class, + context); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentExtendedInner> beginCreateOrUpdate( + String resourceGroupName, String deploymentName, Deployment parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, deploymentName, parameters).getSyncPoller(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of deployment information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentExtendedInner> beginCreateOrUpdate( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, deploymentName, parameters, context).getSyncPoller(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String deploymentName, Deployment parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner createOrUpdate( + String resourceGroupName, String deploymentName, Deployment parameters) { + return createOrUpdateAsync(resourceGroupName, deploymentName, parameters).block(); + } + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. + * The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner createOrUpdate( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, deploymentName, parameters, context).block(); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String deploymentName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExtendedInner getByResourceGroup(String resourceGroupName, String deploymentName) { + return getByResourceGroupAsync(resourceGroupName, deploymentName).block(); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String deploymentName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, deploymentName, context).block(); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync(String resourceGroupName, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .cancel( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .cancel( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String resourceGroupName, String deploymentName) { + return cancelWithResponseAsync(resourceGroupName, deploymentName).flatMap((Response res) -> Mono.empty()); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cancel(String resourceGroupName, String deploymentName) { + cancelAsync(resourceGroupName, deploymentName).block(); + } + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse(String resourceGroupName, String deploymentName, Context context) { + return cancelWithResponseAsync(resourceGroupName, deploymentName, context).block(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateWithResponseAsync( + String resourceGroupName, String deploymentName, Deployment parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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 + .validate( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateWithResponseAsync( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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 + .validate( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentValidateResultInner> beginValidateAsync( + String resourceGroupName, String deploymentName, Deployment parameters) { + Mono>> mono = + validateWithResponseAsync(resourceGroupName, deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentValidateResultInner.class, + DeploymentValidateResultInner.class, + this.client.getContext()); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentValidateResultInner> beginValidateAsync( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + validateWithResponseAsync(resourceGroupName, deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentValidateResultInner.class, + DeploymentValidateResultInner.class, + context); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentValidateResultInner> beginValidate( + String resourceGroupName, String deploymentName, Deployment parameters) { + return beginValidateAsync(resourceGroupName, deploymentName, parameters).getSyncPoller(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentValidateResultInner> beginValidate( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + return beginValidateAsync(resourceGroupName, deploymentName, parameters, context).getSyncPoller(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAsync( + String resourceGroupName, String deploymentName, Deployment parameters) { + return beginValidateAsync(resourceGroupName, deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAsync( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + return beginValidateAsync(resourceGroupName, deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentValidateResultInner validate( + String resourceGroupName, String deploymentName, Deployment parameters) { + return validateAsync(resourceGroupName, deploymentName, parameters).block(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentValidateResultInner validate( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + return validateAsync(resourceGroupName, deploymentName, parameters, context).block(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> whatIfWithResponseAsync( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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 + .whatIf( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> whatIfWithResponseAsync( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 (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 + .whatIf( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WhatIfOperationResultInner> beginWhatIfAsync( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + Mono>> mono = whatIfWithResponseAsync(resourceGroupName, deploymentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WhatIfOperationResultInner.class, + WhatIfOperationResultInner.class, + this.client.getContext()); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WhatIfOperationResultInner> beginWhatIfAsync( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + whatIfWithResponseAsync(resourceGroupName, deploymentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WhatIfOperationResultInner.class, + WhatIfOperationResultInner.class, + context); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WhatIfOperationResultInner> beginWhatIf( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + return beginWhatIfAsync(resourceGroupName, deploymentName, parameters).getSyncPoller(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WhatIfOperationResultInner> beginWhatIf( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, Context context) { + return beginWhatIfAsync(resourceGroupName, deploymentName, parameters, context).getSyncPoller(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono whatIfAsync( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + return beginWhatIfAsync(resourceGroupName, deploymentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono whatIfAsync( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, Context context) { + return beginWhatIfAsync(resourceGroupName, deploymentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WhatIfOperationResultInner whatIf( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + return whatIfAsync(resourceGroupName, deploymentName, parameters).block(); + } + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WhatIfOperationResultInner whatIf( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, Context context) { + return whatIfAsync(resourceGroupName, deploymentName, parameters, context).block(); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportTemplateWithResponseAsync( + String resourceGroupName, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .exportTemplate( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportTemplateWithResponseAsync( + String resourceGroupName, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName 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 + .exportTemplate( + this.client.getEndpoint(), + resourceGroupName, + deploymentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportTemplateAsync(String resourceGroupName, String deploymentName) { + return exportTemplateWithResponseAsync(resourceGroupName, deploymentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployment export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentExportResultInner exportTemplate(String resourceGroupName, String deploymentName) { + return exportTemplateAsync(resourceGroupName, deploymentName).block(); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportTemplateWithResponse( + String resourceGroupName, String deploymentName, Context context) { + return exportTemplateWithResponseAsync(resourceGroupName, deploymentName, context).block(); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments for a resource group along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + filter, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a resource group along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + filter, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the deployments for a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String filter, Integer top) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the deployments for a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String filter = null; + final Integer top = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String filter, Integer top, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, top, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the deployments for a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String filter = null; + final Integer top = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, top)); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Integer top, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, top, context)); + } + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to calculate template hash along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> calculateTemplateHashWithResponseAsync(Object template) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (template == null) { + return Mono.error(new IllegalArgumentException("Parameter template is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .calculateTemplateHash( + this.client.getEndpoint(), this.client.getApiVersion(), template, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @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 result of the request to calculate template hash along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> calculateTemplateHashWithResponseAsync( + Object template, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (template == null) { + return Mono.error(new IllegalArgumentException("Parameter template is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .calculateTemplateHash(this.client.getEndpoint(), this.client.getApiVersion(), template, accept, context); + } + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to calculate template hash on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono calculateTemplateHashAsync(Object template) { + return calculateTemplateHashWithResponseAsync(template) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to calculate template hash. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TemplateHashResultInner calculateTemplateHash(Object template) { + return calculateTemplateHashAsync(template).block(); + } + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @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 result of the request to calculate template hash along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response calculateTemplateHashWithResponse(Object template, Context context) { + return calculateTemplateHashWithResponseAsync(template, 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 list of deployments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtScopeNextSinglePageAsync(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.listAtScopeNext(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 list of deployments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtScopeNextSinglePageAsync( + 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 + .listAtScopeNext(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 list of deployments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeNextSinglePageAsync(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.listAtTenantScopeNext(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 list of deployments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeNextSinglePageAsync( + 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 + .listAtTenantScopeNext(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 list of deployments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtManagementGroupScopeNextSinglePageAsync( + 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.listAtManagementGroupScopeNext(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 list of deployments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtManagementGroupScopeNextSinglePageAsync( + 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 + .listAtManagementGroupScopeNext(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 list of deployments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtSubscriptionScopeNextSinglePageAsync(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.listAtSubscriptionScopeNext(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 list of deployments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtSubscriptionScopeNextSinglePageAsync( + 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 + .listAtSubscriptionScopeNext(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 list of deployments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of deployments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentsImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentsImpl.java new file mode 100644 index 0000000000000..d25624c47ce17 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/DeploymentsImpl.java @@ -0,0 +1,837 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.DeploymentsClient; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExportResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExtendedInner; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentValidateResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.TemplateHashResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.WhatIfOperationResultInner; +import com.azure.resourcemanager.resources.generated.models.Deployment; +import com.azure.resourcemanager.resources.generated.models.DeploymentExportResult; +import com.azure.resourcemanager.resources.generated.models.DeploymentExtended; +import com.azure.resourcemanager.resources.generated.models.DeploymentValidateResult; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.Deployments; +import com.azure.resourcemanager.resources.generated.models.ScopedDeployment; +import com.azure.resourcemanager.resources.generated.models.ScopedDeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.TemplateHashResult; +import com.azure.resourcemanager.resources.generated.models.WhatIfOperationResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DeploymentsImpl implements Deployments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentsImpl.class); + + private final DeploymentsClient innerClient; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + public DeploymentsImpl( + DeploymentsClient innerClient, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteAtScope(String scope, String deploymentName) { + this.serviceClient().deleteAtScope(scope, deploymentName); + } + + public void deleteAtScope(String scope, String deploymentName, Context context) { + this.serviceClient().deleteAtScope(scope, deploymentName, context); + } + + public boolean checkExistenceAtScope(String scope, String deploymentName) { + return this.serviceClient().checkExistenceAtScope(scope, deploymentName); + } + + public Response checkExistenceAtScopeWithResponse(String scope, String deploymentName, Context context) { + return this.serviceClient().checkExistenceAtScopeWithResponse(scope, deploymentName, context); + } + + public DeploymentExtended createOrUpdateAtScope(String scope, String deploymentName, Deployment parameters) { + DeploymentExtendedInner inner = this.serviceClient().createOrUpdateAtScope(scope, deploymentName, parameters); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExtended createOrUpdateAtScope( + String scope, String deploymentName, Deployment parameters, Context context) { + DeploymentExtendedInner inner = + this.serviceClient().createOrUpdateAtScope(scope, deploymentName, parameters, context); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExtended getAtScope(String scope, String deploymentName) { + DeploymentExtendedInner inner = this.serviceClient().getAtScope(scope, deploymentName); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtScopeWithResponse(String scope, String deploymentName, Context context) { + Response inner = + this.serviceClient().getAtScopeWithResponse(scope, deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentExtendedImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void cancelAtScope(String scope, String deploymentName) { + this.serviceClient().cancelAtScope(scope, deploymentName); + } + + public Response cancelAtScopeWithResponse(String scope, String deploymentName, Context context) { + return this.serviceClient().cancelAtScopeWithResponse(scope, deploymentName, context); + } + + public DeploymentValidateResult validateAtScope(String scope, String deploymentName, Deployment parameters) { + DeploymentValidateResultInner inner = this.serviceClient().validateAtScope(scope, deploymentName, parameters); + if (inner != null) { + return new DeploymentValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentValidateResult validateAtScope( + String scope, String deploymentName, Deployment parameters, Context context) { + DeploymentValidateResultInner inner = + this.serviceClient().validateAtScope(scope, deploymentName, parameters, context); + if (inner != null) { + return new DeploymentValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExportResult exportTemplateAtScope(String scope, String deploymentName) { + DeploymentExportResultInner inner = this.serviceClient().exportTemplateAtScope(scope, deploymentName); + if (inner != null) { + return new DeploymentExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response exportTemplateAtScopeWithResponse( + String scope, String deploymentName, Context context) { + Response inner = + this.serviceClient().exportTemplateAtScopeWithResponse(scope, deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentExportResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listAtScope(String scope) { + PagedIterable inner = this.serviceClient().listAtScope(scope); + return Utils.mapPage(inner, inner1 -> new DeploymentExtendedImpl(inner1, this.manager())); + } + + public PagedIterable listAtScope(String scope, String filter, Integer top, Context context) { + PagedIterable inner = this.serviceClient().listAtScope(scope, filter, top, context); + return Utils.mapPage(inner, inner1 -> new DeploymentExtendedImpl(inner1, this.manager())); + } + + public void deleteAtTenantScope(String deploymentName) { + this.serviceClient().deleteAtTenantScope(deploymentName); + } + + public void deleteAtTenantScope(String deploymentName, Context context) { + this.serviceClient().deleteAtTenantScope(deploymentName, context); + } + + public boolean checkExistenceAtTenantScope(String deploymentName) { + return this.serviceClient().checkExistenceAtTenantScope(deploymentName); + } + + public Response checkExistenceAtTenantScopeWithResponse(String deploymentName, Context context) { + return this.serviceClient().checkExistenceAtTenantScopeWithResponse(deploymentName, context); + } + + public DeploymentExtended createOrUpdateAtTenantScope(String deploymentName, ScopedDeployment parameters) { + DeploymentExtendedInner inner = this.serviceClient().createOrUpdateAtTenantScope(deploymentName, parameters); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExtended createOrUpdateAtTenantScope( + String deploymentName, ScopedDeployment parameters, Context context) { + DeploymentExtendedInner inner = + this.serviceClient().createOrUpdateAtTenantScope(deploymentName, parameters, context); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExtended getAtTenantScope(String deploymentName) { + DeploymentExtendedInner inner = this.serviceClient().getAtTenantScope(deploymentName); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtTenantScopeWithResponse(String deploymentName, Context context) { + Response inner = + this.serviceClient().getAtTenantScopeWithResponse(deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentExtendedImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void cancelAtTenantScope(String deploymentName) { + this.serviceClient().cancelAtTenantScope(deploymentName); + } + + public Response cancelAtTenantScopeWithResponse(String deploymentName, Context context) { + return this.serviceClient().cancelAtTenantScopeWithResponse(deploymentName, context); + } + + public DeploymentValidateResult validateAtTenantScope(String deploymentName, ScopedDeployment parameters) { + DeploymentValidateResultInner inner = this.serviceClient().validateAtTenantScope(deploymentName, parameters); + if (inner != null) { + return new DeploymentValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentValidateResult validateAtTenantScope( + String deploymentName, ScopedDeployment parameters, Context context) { + DeploymentValidateResultInner inner = + this.serviceClient().validateAtTenantScope(deploymentName, parameters, context); + if (inner != null) { + return new DeploymentValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public WhatIfOperationResult whatIfAtTenantScope(String deploymentName, ScopedDeploymentWhatIf parameters) { + WhatIfOperationResultInner inner = this.serviceClient().whatIfAtTenantScope(deploymentName, parameters); + if (inner != null) { + return new WhatIfOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public WhatIfOperationResult whatIfAtTenantScope( + String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + WhatIfOperationResultInner inner = + this.serviceClient().whatIfAtTenantScope(deploymentName, parameters, context); + if (inner != null) { + return new WhatIfOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExportResult exportTemplateAtTenantScope(String deploymentName) { + DeploymentExportResultInner inner = this.serviceClient().exportTemplateAtTenantScope(deploymentName); + if (inner != null) { + return new DeploymentExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response exportTemplateAtTenantScopeWithResponse( + String deploymentName, Context context) { + Response inner = + this.serviceClient().exportTemplateAtTenantScopeWithResponse(deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentExportResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listAtTenantScope() { + PagedIterable inner = this.serviceClient().listAtTenantScope(); + return Utils.mapPage(inner, inner1 -> new DeploymentExtendedImpl(inner1, this.manager())); + } + + public PagedIterable listAtTenantScope(String filter, Integer top, Context context) { + PagedIterable inner = this.serviceClient().listAtTenantScope(filter, top, context); + return Utils.mapPage(inner, inner1 -> new DeploymentExtendedImpl(inner1, this.manager())); + } + + public void deleteAtManagementGroupScope(String groupId, String deploymentName) { + this.serviceClient().deleteAtManagementGroupScope(groupId, deploymentName); + } + + public void deleteAtManagementGroupScope(String groupId, String deploymentName, Context context) { + this.serviceClient().deleteAtManagementGroupScope(groupId, deploymentName, context); + } + + public boolean checkExistenceAtManagementGroupScope(String groupId, String deploymentName) { + return this.serviceClient().checkExistenceAtManagementGroupScope(groupId, deploymentName); + } + + public Response checkExistenceAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context) { + return this.serviceClient().checkExistenceAtManagementGroupScopeWithResponse(groupId, deploymentName, context); + } + + public DeploymentExtended createOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters) { + DeploymentExtendedInner inner = + this.serviceClient().createOrUpdateAtManagementGroupScope(groupId, deploymentName, parameters); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExtended createOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + DeploymentExtendedInner inner = + this.serviceClient().createOrUpdateAtManagementGroupScope(groupId, deploymentName, parameters, context); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExtended getAtManagementGroupScope(String groupId, String deploymentName) { + DeploymentExtendedInner inner = this.serviceClient().getAtManagementGroupScope(groupId, deploymentName); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context) { + Response inner = + this.serviceClient().getAtManagementGroupScopeWithResponse(groupId, deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentExtendedImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void cancelAtManagementGroupScope(String groupId, String deploymentName) { + this.serviceClient().cancelAtManagementGroupScope(groupId, deploymentName); + } + + public Response cancelAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context) { + return this.serviceClient().cancelAtManagementGroupScopeWithResponse(groupId, deploymentName, context); + } + + public DeploymentValidateResult validateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters) { + DeploymentValidateResultInner inner = + this.serviceClient().validateAtManagementGroupScope(groupId, deploymentName, parameters); + if (inner != null) { + return new DeploymentValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentValidateResult validateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context) { + DeploymentValidateResultInner inner = + this.serviceClient().validateAtManagementGroupScope(groupId, deploymentName, parameters, context); + if (inner != null) { + return new DeploymentValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public WhatIfOperationResult whatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters) { + WhatIfOperationResultInner inner = + this.serviceClient().whatIfAtManagementGroupScope(groupId, deploymentName, parameters); + if (inner != null) { + return new WhatIfOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public WhatIfOperationResult whatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters, Context context) { + WhatIfOperationResultInner inner = + this.serviceClient().whatIfAtManagementGroupScope(groupId, deploymentName, parameters, context); + if (inner != null) { + return new WhatIfOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExportResult exportTemplateAtManagementGroupScope(String groupId, String deploymentName) { + DeploymentExportResultInner inner = + this.serviceClient().exportTemplateAtManagementGroupScope(groupId, deploymentName); + if (inner != null) { + return new DeploymentExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response exportTemplateAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context) { + Response inner = + this.serviceClient().exportTemplateAtManagementGroupScopeWithResponse(groupId, deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentExportResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listAtManagementGroupScope(String groupId) { + PagedIterable inner = this.serviceClient().listAtManagementGroupScope(groupId); + return Utils.mapPage(inner, inner1 -> new DeploymentExtendedImpl(inner1, this.manager())); + } + + public PagedIterable listAtManagementGroupScope( + String groupId, String filter, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listAtManagementGroupScope(groupId, filter, top, context); + return Utils.mapPage(inner, inner1 -> new DeploymentExtendedImpl(inner1, this.manager())); + } + + public void deleteAtSubscriptionScope(String deploymentName) { + this.serviceClient().deleteAtSubscriptionScope(deploymentName); + } + + public void deleteAtSubscriptionScope(String deploymentName, Context context) { + this.serviceClient().deleteAtSubscriptionScope(deploymentName, context); + } + + public boolean checkExistenceAtSubscriptionScope(String deploymentName) { + return this.serviceClient().checkExistenceAtSubscriptionScope(deploymentName); + } + + public Response checkExistenceAtSubscriptionScopeWithResponse(String deploymentName, Context context) { + return this.serviceClient().checkExistenceAtSubscriptionScopeWithResponse(deploymentName, context); + } + + public DeploymentExtended createOrUpdateAtSubscriptionScope(String deploymentName, Deployment parameters) { + DeploymentExtendedInner inner = + this.serviceClient().createOrUpdateAtSubscriptionScope(deploymentName, parameters); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExtended createOrUpdateAtSubscriptionScope( + String deploymentName, Deployment parameters, Context context) { + DeploymentExtendedInner inner = + this.serviceClient().createOrUpdateAtSubscriptionScope(deploymentName, parameters, context); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExtended getAtSubscriptionScope(String deploymentName) { + DeploymentExtendedInner inner = this.serviceClient().getAtSubscriptionScope(deploymentName); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtSubscriptionScopeWithResponse(String deploymentName, Context context) { + Response inner = + this.serviceClient().getAtSubscriptionScopeWithResponse(deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentExtendedImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void cancelAtSubscriptionScope(String deploymentName) { + this.serviceClient().cancelAtSubscriptionScope(deploymentName); + } + + public Response cancelAtSubscriptionScopeWithResponse(String deploymentName, Context context) { + return this.serviceClient().cancelAtSubscriptionScopeWithResponse(deploymentName, context); + } + + public DeploymentValidateResult validateAtSubscriptionScope(String deploymentName, Deployment parameters) { + DeploymentValidateResultInner inner = + this.serviceClient().validateAtSubscriptionScope(deploymentName, parameters); + if (inner != null) { + return new DeploymentValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentValidateResult validateAtSubscriptionScope( + String deploymentName, Deployment parameters, Context context) { + DeploymentValidateResultInner inner = + this.serviceClient().validateAtSubscriptionScope(deploymentName, parameters, context); + if (inner != null) { + return new DeploymentValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public WhatIfOperationResult whatIfAtSubscriptionScope(String deploymentName, DeploymentWhatIf parameters) { + WhatIfOperationResultInner inner = this.serviceClient().whatIfAtSubscriptionScope(deploymentName, parameters); + if (inner != null) { + return new WhatIfOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public WhatIfOperationResult whatIfAtSubscriptionScope( + String deploymentName, DeploymentWhatIf parameters, Context context) { + WhatIfOperationResultInner inner = + this.serviceClient().whatIfAtSubscriptionScope(deploymentName, parameters, context); + if (inner != null) { + return new WhatIfOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExportResult exportTemplateAtSubscriptionScope(String deploymentName) { + DeploymentExportResultInner inner = this.serviceClient().exportTemplateAtSubscriptionScope(deploymentName); + if (inner != null) { + return new DeploymentExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response exportTemplateAtSubscriptionScopeWithResponse( + String deploymentName, Context context) { + Response inner = + this.serviceClient().exportTemplateAtSubscriptionScopeWithResponse(deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentExportResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DeploymentExtendedImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(filter, top, context); + return Utils.mapPage(inner, inner1 -> new DeploymentExtendedImpl(inner1, this.manager())); + } + + public void deleteByResourceGroup(String resourceGroupName, String deploymentName) { + this.serviceClient().delete(resourceGroupName, deploymentName); + } + + public void delete(String resourceGroupName, String deploymentName, Context context) { + this.serviceClient().delete(resourceGroupName, deploymentName, context); + } + + public boolean checkExistence(String resourceGroupName, String deploymentName) { + return this.serviceClient().checkExistence(resourceGroupName, deploymentName); + } + + public Response checkExistenceWithResponse( + String resourceGroupName, String deploymentName, Context context) { + return this.serviceClient().checkExistenceWithResponse(resourceGroupName, deploymentName, context); + } + + public DeploymentExtended getByResourceGroup(String resourceGroupName, String deploymentName) { + DeploymentExtendedInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, deploymentName); + if (inner != null) { + return new DeploymentExtendedImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String deploymentName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentExtendedImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void cancel(String resourceGroupName, String deploymentName) { + this.serviceClient().cancel(resourceGroupName, deploymentName); + } + + public Response cancelWithResponse(String resourceGroupName, String deploymentName, Context context) { + return this.serviceClient().cancelWithResponse(resourceGroupName, deploymentName, context); + } + + public DeploymentValidateResult validate(String resourceGroupName, String deploymentName, Deployment parameters) { + DeploymentValidateResultInner inner = + this.serviceClient().validate(resourceGroupName, deploymentName, parameters); + if (inner != null) { + return new DeploymentValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentValidateResult validate( + String resourceGroupName, String deploymentName, Deployment parameters, Context context) { + DeploymentValidateResultInner inner = + this.serviceClient().validate(resourceGroupName, deploymentName, parameters, context); + if (inner != null) { + return new DeploymentValidateResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public WhatIfOperationResult whatIf(String resourceGroupName, String deploymentName, DeploymentWhatIf parameters) { + WhatIfOperationResultInner inner = this.serviceClient().whatIf(resourceGroupName, deploymentName, parameters); + if (inner != null) { + return new WhatIfOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public WhatIfOperationResult whatIf( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, Context context) { + WhatIfOperationResultInner inner = + this.serviceClient().whatIf(resourceGroupName, deploymentName, parameters, context); + if (inner != null) { + return new WhatIfOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentExportResult exportTemplate(String resourceGroupName, String deploymentName) { + DeploymentExportResultInner inner = this.serviceClient().exportTemplate(resourceGroupName, deploymentName); + if (inner != null) { + return new DeploymentExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response exportTemplateWithResponse( + String resourceGroupName, String deploymentName, Context context) { + Response inner = + this.serviceClient().exportTemplateWithResponse(resourceGroupName, deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentExportResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DeploymentExtendedImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, filter, top, context); + return Utils.mapPage(inner, inner1 -> new DeploymentExtendedImpl(inner1, this.manager())); + } + + public TemplateHashResult calculateTemplateHash(Object template) { + TemplateHashResultInner inner = this.serviceClient().calculateTemplateHash(template); + if (inner != null) { + return new TemplateHashResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response calculateTemplateHashWithResponse(Object template, Context context) { + Response inner = + this.serviceClient().calculateTemplateHashWithResponse(template, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TemplateHashResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DeploymentExtended 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 deploymentName = Utils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, deploymentName, 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 deploymentName = Utils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, deploymentName, 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 deploymentName = Utils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + this.delete(resourceGroupName, deploymentName, 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 deploymentName = Utils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + this.delete(resourceGroupName, deploymentName, context); + } + + private DeploymentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } + + public DeploymentExtendedImpl define(String name) { + return new DeploymentExtendedImpl(name, this.manager()); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/GenericResourceExpandedImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/GenericResourceExpandedImpl.java new file mode 100644 index 0000000000000..04dbd46c25e7a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/GenericResourceExpandedImpl.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceExpandedInner; +import com.azure.resourcemanager.resources.generated.models.ExtendedLocation; +import com.azure.resourcemanager.resources.generated.models.GenericResourceExpanded; +import com.azure.resourcemanager.resources.generated.models.Identity; +import com.azure.resourcemanager.resources.generated.models.Plan; +import com.azure.resourcemanager.resources.generated.models.Sku; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class GenericResourceExpandedImpl implements GenericResourceExpanded { + private GenericResourceExpandedInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + GenericResourceExpandedImpl( + GenericResourceExpandedInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String managedBy() { + return this.innerModel().managedBy(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); + } + + public OffsetDateTime changedTime() { + return this.innerModel().changedTime(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public GenericResourceExpandedInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/GenericResourceImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/GenericResourceImpl.java new file mode 100644 index 0000000000000..54df0b292fdea --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/GenericResourceImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceInner; +import com.azure.resourcemanager.resources.generated.models.ExtendedLocation; +import com.azure.resourcemanager.resources.generated.models.GenericResource; +import com.azure.resourcemanager.resources.generated.models.Identity; +import com.azure.resourcemanager.resources.generated.models.Plan; +import com.azure.resourcemanager.resources.generated.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class GenericResourceImpl implements GenericResource { + private GenericResourceInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + GenericResourceImpl( + GenericResourceInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String managedBy() { + return this.innerModel().managedBy(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public GenericResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/OperationImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/OperationImpl.java new file mode 100644 index 0000000000000..d5e7b6715a61b --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/OperationImpl.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.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.resources.generated.models.Operation; +import com.azure.resourcemanager.resources.generated.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/OperationsClientImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..8ff54b2f79f2d --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.OperationsClient; +import com.azure.resourcemanager.resources.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.resources.generated.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + 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 ResourceManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ResourceManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourceManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ResourceManagementCl") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Resources/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); + } + + /** + * Lists all of the available Microsoft.Resources REST API 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 result of the request to list Microsoft.Resources operations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available Microsoft.Resources REST API 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 result of the request to list Microsoft.Resources operations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available Microsoft.Resources REST API 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 result of the request to list Microsoft.Resources operations as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Microsoft.Resources REST API 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 result of the request to list Microsoft.Resources operations as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available Microsoft.Resources REST API 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 result of the request to list Microsoft.Resources operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available Microsoft.Resources REST API 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 result of the request to list Microsoft.Resources operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 result of the request to list Microsoft.Resources operations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 result of the request to list Microsoft.Resources operations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/OperationsImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..5e671b0e6c185 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/OperationsImpl.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.resources.generated.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.resources.generated.fluent.OperationsClient; +import com.azure.resourcemanager.resources.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.resources.generated.models.Operation; +import com.azure.resourcemanager.resources.generated.models.Operations; +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.resources.generated.ResourceManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderImpl.java new file mode 100644 index 0000000000000..c4ab9670f59e7 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderInner; +import com.azure.resourcemanager.resources.generated.models.Provider; +import com.azure.resourcemanager.resources.generated.models.ProviderAuthorizationConsentState; +import com.azure.resourcemanager.resources.generated.models.ProviderResourceType; +import java.util.Collections; +import java.util.List; + +public final class ProviderImpl implements Provider { + private ProviderInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + ProviderImpl( + ProviderInner innerObject, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String namespace() { + return this.innerModel().namespace(); + } + + public String registrationState() { + return this.innerModel().registrationState(); + } + + public String registrationPolicy() { + return this.innerModel().registrationPolicy(); + } + + public List resourceTypes() { + List inner = this.innerModel().resourceTypes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProviderAuthorizationConsentState providerAuthorizationConsentState() { + return this.innerModel().providerAuthorizationConsentState(); + } + + public ProviderInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderPermissionListResultImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderPermissionListResultImpl.java new file mode 100644 index 0000000000000..2c8577ca866bd --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderPermissionListResultImpl.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.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderPermissionListResultInner; +import com.azure.resourcemanager.resources.generated.models.ProviderPermission; +import com.azure.resourcemanager.resources.generated.models.ProviderPermissionListResult; +import java.util.Collections; +import java.util.List; + +public final class ProviderPermissionListResultImpl implements ProviderPermissionListResult { + private ProviderPermissionListResultInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + ProviderPermissionListResultImpl( + ProviderPermissionListResultInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public ProviderPermissionListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderResourceTypeListResultImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderResourceTypeListResultImpl.java new file mode 100644 index 0000000000000..e2a5f4449fff5 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderResourceTypeListResultImpl.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.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderResourceTypeListResultInner; +import com.azure.resourcemanager.resources.generated.models.ProviderResourceType; +import com.azure.resourcemanager.resources.generated.models.ProviderResourceTypeListResult; +import java.util.Collections; +import java.util.List; + +public final class ProviderResourceTypeListResultImpl implements ProviderResourceTypeListResult { + private ProviderResourceTypeListResultInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + ProviderResourceTypeListResultImpl( + ProviderResourceTypeListResultInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public ProviderResourceTypeListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderResourceTypesClientImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderResourceTypesClientImpl.java new file mode 100644 index 0000000000000..d2ef9be352edc --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderResourceTypesClientImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.fluent.ProviderResourceTypesClient; +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderResourceTypeListResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ProviderResourceTypesClient. */ +public final class ProviderResourceTypesClientImpl implements ProviderResourceTypesClient { + private final ClientLogger logger = new ClientLogger(ProviderResourceTypesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ProviderResourceTypesService service; + + /** The service client containing this operation class. */ + private final ResourceManagementClientImpl client; + + /** + * Initializes an instance of ProviderResourceTypesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProviderResourceTypesClientImpl(ResourceManagementClientImpl client) { + this.service = + RestProxy + .create(ProviderResourceTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourceManagementClientProviderResourceTypes to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ResourceManagementCl") + private interface ProviderResourceTypesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/resourceTypes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$expand") String expand, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the resource types for a specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of resource types of a resource provider along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceProviderNamespace, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace 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(), + expand, + resourceProviderNamespace, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the resource types for a specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 list of resource types of a resource provider along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceProviderNamespace, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace 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(), + expand, + resourceProviderNamespace, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * List the resource types for a specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of resource types of a resource provider on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceProviderNamespace, String expand) { + return listWithResponseAsync(resourceProviderNamespace, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List the resource types for a specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of resource types of a resource provider on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceProviderNamespace) { + final String expand = null; + return listWithResponseAsync(resourceProviderNamespace, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List the resource types for a specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of resource types of a resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProviderResourceTypeListResultInner list(String resourceProviderNamespace) { + final String expand = null; + return listAsync(resourceProviderNamespace, expand).block(); + } + + /** + * List the resource types for a specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 list of resource types of a resource provider along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceProviderNamespace, String expand, Context context) { + return listWithResponseAsync(resourceProviderNamespace, expand, context).block(); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderResourceTypesImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderResourceTypesImpl.java new file mode 100644 index 0000000000000..8ba29a26d6ea9 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProviderResourceTypesImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.ProviderResourceTypesClient; +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderResourceTypeListResultInner; +import com.azure.resourcemanager.resources.generated.models.ProviderResourceTypeListResult; +import com.azure.resourcemanager.resources.generated.models.ProviderResourceTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ProviderResourceTypesImpl implements ProviderResourceTypes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderResourceTypesImpl.class); + + private final ProviderResourceTypesClient innerClient; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + public ProviderResourceTypesImpl( + ProviderResourceTypesClient innerClient, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ProviderResourceTypeListResult list(String resourceProviderNamespace) { + ProviderResourceTypeListResultInner inner = this.serviceClient().list(resourceProviderNamespace); + if (inner != null) { + return new ProviderResourceTypeListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceProviderNamespace, String expand, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceProviderNamespace, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProviderResourceTypeListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ProviderResourceTypesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProvidersClientImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProvidersClientImpl.java new file mode 100644 index 0000000000000..4b835be9dc2c3 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProvidersClientImpl.java @@ -0,0 +1,1576 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.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.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.resources.generated.fluent.ProvidersClient; +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderInner; +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderPermissionListResultInner; +import com.azure.resourcemanager.resources.generated.models.ProviderListResult; +import com.azure.resourcemanager.resources.generated.models.ProviderRegistrationRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ProvidersClient. */ +public final class ProvidersClientImpl implements ProvidersClient { + private final ClientLogger logger = new ClientLogger(ProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ProvidersService service; + + /** The service client containing this operation class. */ + private final ResourceManagementClientImpl client; + + /** + * Initializes an instance of ProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProvidersClientImpl(ResourceManagementClientImpl client) { + this.service = + RestProxy.create(ProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourceManagementClientProviders to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ResourceManagementCl") + private interface ProvidersService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> unregister( + @HostParam("$host") String endpoint, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> registerAtManagementGroupScope( + @HostParam("$host") String endpoint, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @QueryParam("api-version") String apiVersion, + @PathParam("groupId") String groupId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/providerPermissions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> providerPermissions( + @HostParam("$host") String endpoint, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> register( + @HostParam("$host") String endpoint, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ProviderRegistrationRequest properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtTenantScope( + @HostParam("$host") String endpoint, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("$expand") String expand, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/{resourceProviderNamespace}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtTenantScope( + @HostParam("$host") String endpoint, + @QueryParam("$expand") String expand, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @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); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAtTenantScopeNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource provider information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> unregisterWithResponseAsync(String resourceProviderNamespace) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace 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 + .unregister( + this.client.getEndpoint(), + resourceProviderNamespace, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @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 resource provider information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> unregisterWithResponseAsync( + String resourceProviderNamespace, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace 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 + .unregister( + this.client.getEndpoint(), + resourceProviderNamespace, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource provider information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono unregisterAsync(String resourceProviderNamespace) { + return unregisterWithResponseAsync(resourceProviderNamespace) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource provider information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProviderInner unregister(String resourceProviderNamespace) { + return unregisterAsync(resourceProviderNamespace).block(); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @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 resource provider information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unregisterWithResponse(String resourceProviderNamespace, Context context) { + return unregisterWithResponseAsync(resourceProviderNamespace, context).block(); + } + + /** + * Registers a management group with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param groupId The management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> registerAtManagementGroupScopeWithResponseAsync( + String resourceProviderNamespace, String groupId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .registerAtManagementGroupScope( + this.client.getEndpoint(), + resourceProviderNamespace, + this.client.getApiVersion(), + groupId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Registers a management group with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param groupId The management group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> registerAtManagementGroupScopeWithResponseAsync( + String resourceProviderNamespace, String groupId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .registerAtManagementGroupScope( + this.client.getEndpoint(), + resourceProviderNamespace, + this.client.getApiVersion(), + groupId, + accept, + context); + } + + /** + * Registers a management group with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param groupId The management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono registerAtManagementGroupScopeAsync(String resourceProviderNamespace, String groupId) { + return registerAtManagementGroupScopeWithResponseAsync(resourceProviderNamespace, groupId) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Registers a management group with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param groupId The management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 registerAtManagementGroupScope(String resourceProviderNamespace, String groupId) { + registerAtManagementGroupScopeAsync(resourceProviderNamespace, groupId).block(); + } + + /** + * Registers a management group with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param groupId The management group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response registerAtManagementGroupScopeWithResponse( + String resourceProviderNamespace, String groupId, Context context) { + return registerAtManagementGroupScopeWithResponseAsync(resourceProviderNamespace, groupId, context).block(); + } + + /** + * Get the provider permissions. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 provider permissions along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> providerPermissionsWithResponseAsync( + String resourceProviderNamespace) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace 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 + .providerPermissions( + this.client.getEndpoint(), + resourceProviderNamespace, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the provider permissions. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the provider permissions along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> providerPermissionsWithResponseAsync( + String resourceProviderNamespace, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace 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 + .providerPermissions( + this.client.getEndpoint(), + resourceProviderNamespace, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Get the provider permissions. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 provider permissions on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono providerPermissionsAsync(String resourceProviderNamespace) { + return providerPermissionsWithResponseAsync(resourceProviderNamespace) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the provider permissions. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 provider permissions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProviderPermissionListResultInner providerPermissions(String resourceProviderNamespace) { + return providerPermissionsAsync(resourceProviderNamespace).block(); + } + + /** + * Get the provider permissions. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the provider permissions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response providerPermissionsWithResponse( + String resourceProviderNamespace, Context context) { + return providerPermissionsWithResponseAsync(resourceProviderNamespace, context).block(); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param properties The third party consent for S2S. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource provider information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> registerWithResponseAsync( + String resourceProviderNamespace, ProviderRegistrationRequest properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace 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 (properties != null) { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .register( + this.client.getEndpoint(), + resourceProviderNamespace, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param properties The third party consent for S2S. + * @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 resource provider information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> registerWithResponseAsync( + String resourceProviderNamespace, ProviderRegistrationRequest properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace 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 (properties != null) { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .register( + this.client.getEndpoint(), + resourceProviderNamespace, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + properties, + accept, + context); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param properties The third party consent for S2S. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource provider information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono registerAsync( + String resourceProviderNamespace, ProviderRegistrationRequest properties) { + return registerWithResponseAsync(resourceProviderNamespace, properties) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource provider information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono registerAsync(String resourceProviderNamespace) { + final ProviderRegistrationRequest properties = null; + return registerWithResponseAsync(resourceProviderNamespace, properties) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource provider information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProviderInner register(String resourceProviderNamespace) { + final ProviderRegistrationRequest properties = null; + return registerAsync(resourceProviderNamespace, properties).block(); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param properties The third party consent for S2S. + * @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 resource provider information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response registerWithResponse( + String resourceProviderNamespace, ProviderRegistrationRequest properties, Context context) { + return registerWithResponseAsync(resourceProviderNamespace, properties, context).block(); + } + + /** + * Gets all resource providers for a subscription. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 resource providers for a subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand) { + 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(), + expand, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all resource providers for a subscription. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 resource providers for a subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand, 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(), + expand, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all resource providers for a subscription. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 resource providers for a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand) { + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all resource providers for a 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 all resource providers for a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String expand = null; + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all resource providers for a subscription. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 resource providers for a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all resource providers for a 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 all resource providers for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String expand = null; + return new PagedIterable<>(listAsync(expand)); + } + + /** + * Gets all resource providers for a subscription. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 resource providers for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String expand, Context context) { + return new PagedIterable<>(listAsync(expand, context)); + } + + /** + * Gets all resource providers for the tenant. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 resource providers for the tenant along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeSinglePageAsync(String expand) { + 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 + .listAtTenantScope( + this.client.getEndpoint(), expand, 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 resource providers for the tenant. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 resource providers for the tenant along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeSinglePageAsync(String expand, 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 + .listAtTenantScope(this.client.getEndpoint(), expand, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all resource providers for the tenant. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 resource providers for the tenant as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtTenantScopeAsync(String expand) { + return new PagedFlux<>( + () -> listAtTenantScopeSinglePageAsync(expand), nextLink -> listAtTenantScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all resource providers for the tenant. + * + * @throws 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 resource providers for the tenant as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtTenantScopeAsync() { + final String expand = null; + return new PagedFlux<>( + () -> listAtTenantScopeSinglePageAsync(expand), nextLink -> listAtTenantScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all resource providers for the tenant. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 resource providers for the tenant as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAtTenantScopeAsync(String expand, Context context) { + return new PagedFlux<>( + () -> listAtTenantScopeSinglePageAsync(expand, context), + nextLink -> listAtTenantScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all resource providers for the tenant. + * + * @throws 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 resource providers for the tenant as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtTenantScope() { + final String expand = null; + return new PagedIterable<>(listAtTenantScopeAsync(expand)); + } + + /** + * Gets all resource providers for the tenant. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 resource providers for the tenant as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAtTenantScope(String expand, Context context) { + return new PagedIterable<>(listAtTenantScopeAsync(expand, context)); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified resource provider along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceProviderNamespace, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace 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 + .get( + this.client.getEndpoint(), + expand, + resourceProviderNamespace, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 specified resource provider along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceProviderNamespace, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace 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 + .get( + this.client.getEndpoint(), + expand, + resourceProviderNamespace, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified resource provider on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceProviderNamespace, String expand) { + return getWithResponseAsync(resourceProviderNamespace, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified resource provider on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceProviderNamespace) { + final String expand = null; + return getWithResponseAsync(resourceProviderNamespace, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProviderInner get(String resourceProviderNamespace) { + final String expand = null; + return getAsync(resourceProviderNamespace, expand).block(); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 specified resource provider along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceProviderNamespace, String expand, Context context) { + return getWithResponseAsync(resourceProviderNamespace, expand, context).block(); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified resource provider at the tenant level along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtTenantScopeWithResponseAsync( + String resourceProviderNamespace, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAtTenantScope( + this.client.getEndpoint(), + expand, + resourceProviderNamespace, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 specified resource provider at the tenant level along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtTenantScopeWithResponseAsync( + String resourceProviderNamespace, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAtTenantScope( + this.client.getEndpoint(), + expand, + resourceProviderNamespace, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified resource provider at the tenant level on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtTenantScopeAsync(String resourceProviderNamespace, String expand) { + return getAtTenantScopeWithResponseAsync(resourceProviderNamespace, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified resource provider at the tenant level on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtTenantScopeAsync(String resourceProviderNamespace) { + final String expand = null; + return getAtTenantScopeWithResponseAsync(resourceProviderNamespace, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specified resource provider at the tenant level. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProviderInner getAtTenantScope(String resourceProviderNamespace) { + final String expand = null; + return getAtTenantScopeAsync(resourceProviderNamespace, expand).block(); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 specified resource provider at the tenant level along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtTenantScopeWithResponse( + String resourceProviderNamespace, String expand, Context context) { + return getAtTenantScopeWithResponseAsync(resourceProviderNamespace, expand, 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 list of resource providers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of resource providers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 list of resource providers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeNextSinglePageAsync(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.listAtTenantScopeNext(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 list of resource providers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAtTenantScopeNextSinglePageAsync(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 + .listAtTenantScopeNext(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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProvidersImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProvidersImpl.java new file mode 100644 index 0000000000000..6b4a2c57e30f7 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ProvidersImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.ProvidersClient; +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderInner; +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderPermissionListResultInner; +import com.azure.resourcemanager.resources.generated.models.Provider; +import com.azure.resourcemanager.resources.generated.models.ProviderPermissionListResult; +import com.azure.resourcemanager.resources.generated.models.ProviderRegistrationRequest; +import com.azure.resourcemanager.resources.generated.models.Providers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ProvidersImpl implements Providers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProvidersImpl.class); + + private final ProvidersClient innerClient; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + public ProvidersImpl( + ProvidersClient innerClient, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Provider unregister(String resourceProviderNamespace) { + ProviderInner inner = this.serviceClient().unregister(resourceProviderNamespace); + if (inner != null) { + return new ProviderImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response unregisterWithResponse(String resourceProviderNamespace, Context context) { + Response inner = this.serviceClient().unregisterWithResponse(resourceProviderNamespace, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProviderImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void registerAtManagementGroupScope(String resourceProviderNamespace, String groupId) { + this.serviceClient().registerAtManagementGroupScope(resourceProviderNamespace, groupId); + } + + public Response registerAtManagementGroupScopeWithResponse( + String resourceProviderNamespace, String groupId, Context context) { + return this + .serviceClient() + .registerAtManagementGroupScopeWithResponse(resourceProviderNamespace, groupId, context); + } + + public ProviderPermissionListResult providerPermissions(String resourceProviderNamespace) { + ProviderPermissionListResultInner inner = this.serviceClient().providerPermissions(resourceProviderNamespace); + if (inner != null) { + return new ProviderPermissionListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response providerPermissionsWithResponse( + String resourceProviderNamespace, Context context) { + Response inner = + this.serviceClient().providerPermissionsWithResponse(resourceProviderNamespace, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProviderPermissionListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Provider register(String resourceProviderNamespace) { + ProviderInner inner = this.serviceClient().register(resourceProviderNamespace); + if (inner != null) { + return new ProviderImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response registerWithResponse( + String resourceProviderNamespace, ProviderRegistrationRequest properties, Context context) { + Response inner = + this.serviceClient().registerWithResponse(resourceProviderNamespace, properties, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProviderImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ProviderImpl(inner1, this.manager())); + } + + public PagedIterable list(String expand, Context context) { + PagedIterable inner = this.serviceClient().list(expand, context); + return Utils.mapPage(inner, inner1 -> new ProviderImpl(inner1, this.manager())); + } + + public PagedIterable listAtTenantScope() { + PagedIterable inner = this.serviceClient().listAtTenantScope(); + return Utils.mapPage(inner, inner1 -> new ProviderImpl(inner1, this.manager())); + } + + public PagedIterable listAtTenantScope(String expand, Context context) { + PagedIterable inner = this.serviceClient().listAtTenantScope(expand, context); + return Utils.mapPage(inner, inner1 -> new ProviderImpl(inner1, this.manager())); + } + + public Provider get(String resourceProviderNamespace) { + ProviderInner inner = this.serviceClient().get(resourceProviderNamespace); + if (inner != null) { + return new ProviderImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceProviderNamespace, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceProviderNamespace, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProviderImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Provider getAtTenantScope(String resourceProviderNamespace) { + ProviderInner inner = this.serviceClient().getAtTenantScope(resourceProviderNamespace); + if (inner != null) { + return new ProviderImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtTenantScopeWithResponse( + String resourceProviderNamespace, String expand, Context context) { + Response inner = + this.serviceClient().getAtTenantScopeWithResponse(resourceProviderNamespace, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProviderImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupExportResultImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupExportResultImpl.java new file mode 100644 index 0000000000000..b80ee65278b7b --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupExportResultImpl.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.resources.generated.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupExportResultInner; +import com.azure.resourcemanager.resources.generated.models.ResourceGroupExportResult; + +public final class ResourceGroupExportResultImpl implements ResourceGroupExportResult { + private ResourceGroupExportResultInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + ResourceGroupExportResultImpl( + ResourceGroupExportResultInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Object template() { + return this.innerModel().template(); + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public ResourceGroupExportResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupImpl.java new file mode 100644 index 0000000000000..5654a9b6a73e5 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupInner; +import com.azure.resourcemanager.resources.generated.models.ExportTemplateRequest; +import com.azure.resourcemanager.resources.generated.models.ResourceGroup; +import com.azure.resourcemanager.resources.generated.models.ResourceGroupExportResult; +import com.azure.resourcemanager.resources.generated.models.ResourceGroupPatchable; +import com.azure.resourcemanager.resources.generated.models.ResourceGroupProperties; +import java.util.Collections; +import java.util.Map; + +public final class ResourceGroupImpl implements ResourceGroup, ResourceGroup.Definition, ResourceGroup.Update { + private ResourceGroupInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ResourceGroupProperties properties() { + return this.innerModel().properties(); + } + + public String managedBy() { + return this.innerModel().managedBy(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ResourceGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private ResourceGroupPatchable updateParameters; + + public ResourceGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGroups() + .createOrUpdateWithResponse(resourceGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ResourceGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGroups() + .createOrUpdateWithResponse(resourceGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + ResourceGroupImpl(String name, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = new ResourceGroupInner(); + this.serviceManager = serviceManager; + this.resourceGroupName = name; + } + + public ResourceGroupImpl update() { + this.updateParameters = new ResourceGroupPatchable(); + return this; + } + + public ResourceGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGroups() + .updateWithResponse(resourceGroupName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public ResourceGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGroups() + .updateWithResponse(resourceGroupName, updateParameters, context) + .getValue(); + return this; + } + + ResourceGroupImpl( + ResourceGroupInner innerObject, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + } + + public ResourceGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getResourceGroups() + .getWithResponse(resourceGroupName, Context.NONE) + .getValue(); + return this; + } + + public ResourceGroup refresh(Context context) { + this.innerObject = + serviceManager.serviceClient().getResourceGroups().getWithResponse(resourceGroupName, context).getValue(); + return this; + } + + public ResourceGroupExportResult exportTemplate(ExportTemplateRequest parameters) { + return serviceManager.resourceGroups().exportTemplate(resourceGroupName, parameters); + } + + public ResourceGroupExportResult exportTemplate(ExportTemplateRequest parameters, Context context) { + return serviceManager.resourceGroups().exportTemplate(resourceGroupName, parameters, context); + } + + public ResourceGroupImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ResourceGroupImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ResourceGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ResourceGroupImpl withProperties(ResourceGroupProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateParameters.withProperties(properties); + return this; + } + } + + public ResourceGroupImpl withManagedBy(String managedBy) { + if (isInCreateMode()) { + this.innerModel().withManagedBy(managedBy); + return this; + } else { + this.updateParameters.withManagedBy(managedBy); + return this; + } + } + + public ResourceGroupImpl withName(String name) { + this.updateParameters.withName(name); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupsClientImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupsClientImpl.java new file mode 100644 index 0000000000000..4d0e62b3eb0ac --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupsClientImpl.java @@ -0,0 +1,1544 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.Head; +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.resources.generated.fluent.ResourceGroupsClient; +import com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupExportResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupInner; +import com.azure.resourcemanager.resources.generated.models.ExportTemplateRequest; +import com.azure.resourcemanager.resources.generated.models.ResourceGroupListResult; +import com.azure.resourcemanager.resources.generated.models.ResourceGroupPatchable; +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 ResourceGroupsClient. */ +public final class ResourceGroupsClientImpl implements ResourceGroupsClient { + private final ClientLogger logger = new ClientLogger(ResourceGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceGroupsService service; + + /** The service client containing this operation class. */ + private final ResourceManagementClientImpl client; + + /** + * Initializes an instance of ResourceGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceGroupsClientImpl(ResourceManagementClientImpl client) { + this.service = + RestProxy.create(ResourceGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourceManagementClientResourceGroups to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ResourceManagementCl") + private interface ResourceGroupsService { + @Headers({"Content-Type: application/json"}) + @Head("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + @ExpectedResponses({204, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkExistence( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ResourceGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("forceDeletionTypes") String forceDeletionTypes, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ResourceGroupPatchable parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> exportTemplate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ExportTemplateRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourcegroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @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); + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceWithResponseAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .checkExistence( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceWithResponseAsync(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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .checkExistence( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkExistenceAsync(String resourceGroupName) { + return checkExistenceWithResponseAsync(resourceGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean checkExistence(String resourceGroupName) { + Boolean value = checkExistenceAsync(resourceGroupName).block(); + if (value != null) { + return value; + } else { + throw logger.logExceptionAsError(new NullPointerException()); + } + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkExistenceWithResponse(String resourceGroupName, Context context) { + return checkExistenceWithResponseAsync(resourceGroupName, context).block(); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, + * underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed + * characters. + * @param parameters Parameters supplied to the create or update a 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 resource group information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, ResourceGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (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(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, + * underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed + * characters. + * @param parameters Parameters supplied to the create or update a 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 resource group information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, ResourceGroupInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (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(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, + * underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed + * characters. + * @param parameters Parameters supplied to the create or update a 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 resource group information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, ResourceGroupInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, + * underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed + * characters. + * @param parameters Parameters supplied to the create or update a 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 resource group information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceGroupInner createOrUpdate(String resourceGroupName, ResourceGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, parameters).block(); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, + * underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed + * characters. + * @param parameters Parameters supplied to the create or update a 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 resource group information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, ResourceGroupInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, parameters, context).block(); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String forceDeletionTypes) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + forceDeletionTypes, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String forceDeletionTypes, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + forceDeletionTypes, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String forceDeletionTypes) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, forceDeletionTypes); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String forceDeletionTypes, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, forceDeletionTypes, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String forceDeletionTypes) { + return beginDeleteAsync(resourceGroupName, forceDeletionTypes).getSyncPoller(); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String forceDeletionTypes, Context context) { + return beginDeleteAsync(resourceGroupName, forceDeletionTypes, context).getSyncPoller(); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String forceDeletionTypes) { + return beginDeleteAsync(resourceGroupName, forceDeletionTypes) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName) { + final String forceDeletionTypes = null; + return beginDeleteAsync(resourceGroupName, forceDeletionTypes) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String forceDeletionTypes, Context context) { + return beginDeleteAsync(resourceGroupName, forceDeletionTypes, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 forceDeletionTypes) { + deleteAsync(resourceGroupName, forceDeletionTypes).block(); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName) { + final String forceDeletionTypes = null; + deleteAsync(resourceGroupName, forceDeletionTypes).block(); + } + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @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 forceDeletionTypes, Context context) { + deleteAsync(resourceGroupName, forceDeletionTypes, context).block(); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName) { + return getWithResponseAsync(resourceGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceGroupInner get(String resourceGroupName) { + return getAsync(resourceGroupName).block(); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, context).block(); + } + + /** + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is + * the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a 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 resource group information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, ResourceGroupPatchable parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (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(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is + * the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a 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 resource group information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, ResourceGroupPatchable parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (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(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is + * the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a 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 resource group information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, ResourceGroupPatchable parameters) { + return updateWithResponseAsync(resourceGroupName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is + * the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a 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 resource group information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceGroupInner update(String resourceGroupName, ResourceGroupPatchable parameters) { + return updateAsync(resourceGroupName, parameters).block(); + } + + /** + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is + * the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a 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 resource group information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, ResourceGroupPatchable parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, parameters, context).block(); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource group export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportTemplateWithResponseAsync( + String resourceGroupName, ExportTemplateRequest 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 (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 + .exportTemplate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @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 resource group export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportTemplateWithResponseAsync( + String resourceGroupName, ExportTemplateRequest 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 (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 + .exportTemplate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource group export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ResourceGroupExportResultInner> + beginExportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters) { + Mono>> mono = exportTemplateWithResponseAsync(resourceGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ResourceGroupExportResultInner.class, + ResourceGroupExportResultInner.class, + this.client.getContext()); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource group export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ResourceGroupExportResultInner> + beginExportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = exportTemplateWithResponseAsync(resourceGroupName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ResourceGroupExportResultInner.class, + ResourceGroupExportResultInner.class, + context); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource group export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ResourceGroupExportResultInner> beginExportTemplate( + String resourceGroupName, ExportTemplateRequest parameters) { + return beginExportTemplateAsync(resourceGroupName, parameters).getSyncPoller(); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource group export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ResourceGroupExportResultInner> beginExportTemplate( + String resourceGroupName, ExportTemplateRequest parameters, Context context) { + return beginExportTemplateAsync(resourceGroupName, parameters, context).getSyncPoller(); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource group export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportTemplateAsync( + String resourceGroupName, ExportTemplateRequest parameters) { + return beginExportTemplateAsync(resourceGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @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 resource group export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportTemplateAsync( + String resourceGroupName, ExportTemplateRequest parameters, Context context) { + return beginExportTemplateAsync(resourceGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource group export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceGroupExportResultInner exportTemplate(String resourceGroupName, ExportTemplateRequest parameters) { + return exportTemplateAsync(resourceGroupName, parameters).block(); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @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 resource group export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceGroupExportResultInner exportTemplate( + String resourceGroupName, ExportTemplateRequest parameters, Context context) { + return exportTemplateAsync(resourceGroupName, parameters, context).block(); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. + * For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the resource groups for a subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Integer top) { + 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(), + filter, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. + * For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 the resource groups for a subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Integer top, 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(), + filter, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. + * For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the resource groups for a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Integer top) { + return new PagedFlux<>(() -> listSinglePageAsync(filter, top), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the resource groups for a 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 all the resource groups for a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + final Integer top = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter, top), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. + * For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 the resource groups for a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, top, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the resource groups for a 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 all the resource groups for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + final Integer top = null; + return new PagedIterable<>(listAsync(filter, top)); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. + * For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 the resource groups for a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Integer top, Context context) { + return new PagedIterable<>(listAsync(filter, top, 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 list of resource groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of resource groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupsImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupsImpl.java new file mode 100644 index 0000000000000..c9709cd8d3e03 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceGroupsImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.ResourceGroupsClient; +import com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupExportResultInner; +import com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupInner; +import com.azure.resourcemanager.resources.generated.models.ExportTemplateRequest; +import com.azure.resourcemanager.resources.generated.models.ResourceGroup; +import com.azure.resourcemanager.resources.generated.models.ResourceGroupExportResult; +import com.azure.resourcemanager.resources.generated.models.ResourceGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceGroupsImpl implements ResourceGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGroupsImpl.class); + + private final ResourceGroupsClient innerClient; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + public ResourceGroupsImpl( + ResourceGroupsClient innerClient, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public boolean checkExistence(String resourceGroupName) { + return this.serviceClient().checkExistence(resourceGroupName); + } + + public Response checkExistenceWithResponse(String resourceGroupName, Context context) { + return this.serviceClient().checkExistenceWithResponse(resourceGroupName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String forceDeletionTypes) { + this.serviceClient().delete(resourceGroupName, forceDeletionTypes); + } + + public void delete(String resourceGroupName) { + this.serviceClient().delete(resourceGroupName); + } + + public void delete(String resourceGroupName, String forceDeletionTypes, Context context) { + this.serviceClient().delete(resourceGroupName, forceDeletionTypes, context); + } + + public ResourceGroup get(String resourceGroupName) { + ResourceGroupInner inner = this.serviceClient().get(resourceGroupName); + if (inner != null) { + return new ResourceGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceGroupName, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ResourceGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ResourceGroupExportResult exportTemplate(String resourceGroupName, ExportTemplateRequest parameters) { + ResourceGroupExportResultInner inner = this.serviceClient().exportTemplate(resourceGroupName, parameters); + if (inner != null) { + return new ResourceGroupExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ResourceGroupExportResult exportTemplate( + String resourceGroupName, ExportTemplateRequest parameters, Context context) { + ResourceGroupExportResultInner inner = + this.serviceClient().exportTemplate(resourceGroupName, parameters, context); + if (inner != null) { + return new ResourceGroupExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ResourceGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(filter, top, context); + return Utils.mapPage(inner, inner1 -> new ResourceGroupImpl(inner1, this.manager())); + } + + public ResourceGroup 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))); + } + return this.getWithResponse(resourceGroupName, 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))); + } + return this.getWithResponse(resourceGroupName, 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 localForceDeletionTypes = null; + this.delete(resourceGroupName, localForceDeletionTypes, Context.NONE); + } + + public void deleteByIdWithResponse(String id, String forceDeletionTypes, 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))); + } + this.delete(resourceGroupName, forceDeletionTypes, context); + } + + private ResourceGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } + + public ResourceGroupImpl define(String name) { + return new ResourceGroupImpl(name, this.manager()); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceManagementClientBuilder.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceManagementClientBuilder.java new file mode 100644 index 0000000000000..915d2e47c934e --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceManagementClientBuilder.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.resources.generated.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 ResourceManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ResourceManagementClientImpl.class}) +public final class ResourceManagementClientBuilder { + /* + * The Microsoft Azure subscription ID. + */ + private String subscriptionId; + + /** + * Sets The Microsoft Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the ResourceManagementClientBuilder. + */ + public ResourceManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ResourceManagementClientBuilder. + */ + public ResourceManagementClientBuilder 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 ResourceManagementClientBuilder. + */ + public ResourceManagementClientBuilder 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 ResourceManagementClientBuilder. + */ + public ResourceManagementClientBuilder 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 ResourceManagementClientBuilder. + */ + public ResourceManagementClientBuilder 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 ResourceManagementClientBuilder. + */ + public ResourceManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ResourceManagementClientImpl with the provided parameters. + * + * @return an instance of ResourceManagementClientImpl. + */ + public ResourceManagementClientImpl 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(); + } + ResourceManagementClientImpl client = + new ResourceManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceManagementClientImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceManagementClientImpl.java new file mode 100644 index 0000000000000..f7d217680921a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourceManagementClientImpl.java @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.DeploymentOperationsClient; +import com.azure.resourcemanager.resources.generated.fluent.DeploymentsClient; +import com.azure.resourcemanager.resources.generated.fluent.OperationsClient; +import com.azure.resourcemanager.resources.generated.fluent.ProviderResourceTypesClient; +import com.azure.resourcemanager.resources.generated.fluent.ProvidersClient; +import com.azure.resourcemanager.resources.generated.fluent.ResourceGroupsClient; +import com.azure.resourcemanager.resources.generated.fluent.ResourceManagementClient; +import com.azure.resourcemanager.resources.generated.fluent.ResourcesClient; +import com.azure.resourcemanager.resources.generated.fluent.TagOperationsClient; +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 ResourceManagementClientImpl type. */ +@ServiceClient(builder = ResourceManagementClientBuilder.class) +public final class ResourceManagementClientImpl implements ResourceManagementClient { + private final ClientLogger logger = new ClientLogger(ResourceManagementClientImpl.class); + + /** The Microsoft Azure subscription ID. */ + private final String subscriptionId; + + /** + * Gets The Microsoft Azure subscription ID. + * + * @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 DeploymentsClient object to access its operations. */ + private final DeploymentsClient deployments; + + /** + * Gets the DeploymentsClient object to access its operations. + * + * @return the DeploymentsClient object. + */ + public DeploymentsClient getDeployments() { + return this.deployments; + } + + /** The ProvidersClient object to access its operations. */ + private final ProvidersClient providers; + + /** + * Gets the ProvidersClient object to access its operations. + * + * @return the ProvidersClient object. + */ + public ProvidersClient getProviders() { + return this.providers; + } + + /** The ProviderResourceTypesClient object to access its operations. */ + private final ProviderResourceTypesClient providerResourceTypes; + + /** + * Gets the ProviderResourceTypesClient object to access its operations. + * + * @return the ProviderResourceTypesClient object. + */ + public ProviderResourceTypesClient getProviderResourceTypes() { + return this.providerResourceTypes; + } + + /** The ResourcesClient object to access its operations. */ + private final ResourcesClient resources; + + /** + * Gets the ResourcesClient object to access its operations. + * + * @return the ResourcesClient object. + */ + public ResourcesClient getResources() { + return this.resources; + } + + /** The ResourceGroupsClient object to access its operations. */ + private final ResourceGroupsClient resourceGroups; + + /** + * Gets the ResourceGroupsClient object to access its operations. + * + * @return the ResourceGroupsClient object. + */ + public ResourceGroupsClient getResourceGroups() { + return this.resourceGroups; + } + + /** The TagOperationsClient object to access its operations. */ + private final TagOperationsClient tagOperations; + + /** + * Gets the TagOperationsClient object to access its operations. + * + * @return the TagOperationsClient object. + */ + public TagOperationsClient getTagOperations() { + return this.tagOperations; + } + + /** The DeploymentOperationsClient object to access its operations. */ + private final DeploymentOperationsClient deploymentOperations; + + /** + * Gets the DeploymentOperationsClient object to access its operations. + * + * @return the DeploymentOperationsClient object. + */ + public DeploymentOperationsClient getDeploymentOperations() { + return this.deploymentOperations; + } + + /** + * Initializes an instance of ResourceManagementClient 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 Microsoft Azure subscription ID. + * @param endpoint server parameter. + */ + ResourceManagementClientImpl( + 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 = "2021-04-01"; + this.operations = new OperationsClientImpl(this); + this.deployments = new DeploymentsClientImpl(this); + this.providers = new ProvidersClientImpl(this); + this.providerResourceTypes = new ProviderResourceTypesClientImpl(this); + this.resources = new ResourcesClientImpl(this); + this.resourceGroups = new ResourceGroupsClientImpl(this); + this.tagOperations = new TagOperationsClientImpl(this); + this.deploymentOperations = new DeploymentOperationsClientImpl(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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourcesClientImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourcesClientImpl.java new file mode 100644 index 0000000000000..e690f037ea11b --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourcesClientImpl.java @@ -0,0 +1,4479 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.Head; +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.resources.generated.fluent.ResourcesClient; +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceExpandedInner; +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceInner; +import com.azure.resourcemanager.resources.generated.models.ResourceListResult; +import com.azure.resourcemanager.resources.generated.models.ResourcesMoveInfo; +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 ResourcesClient. */ +public final class ResourcesClientImpl implements ResourcesClient { + private final ClientLogger logger = new ClientLogger(ResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourcesService service; + + /** The service client containing this operation class. */ + private final ResourceManagementClientImpl client; + + /** + * Initializes an instance of ResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourcesClientImpl(ResourceManagementClientImpl client) { + this.service = + RestProxy.create(ResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourceManagementClientResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ResourceManagementCl") + private interface ResourcesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$filter") String filter, + @QueryParam("$expand") String expand, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> moveResources( + @HostParam("$host") String endpoint, + @PathParam("sourceResourceGroupName") String sourceResourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ResourcesMoveInfo parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validateMoveResources( + @HostParam("$host") String endpoint, + @PathParam("sourceResourceGroupName") String sourceResourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ResourcesMoveInfo parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("$expand") String expand, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Head( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}" + + "/{parentResourcePath}/{resourceType}/{resourceName}") + @ExpectedResponses({204, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkExistence( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @PathParam(value = "parentResourcePath", encoded = true) String parentResourcePath, + @PathParam(value = "resourceType", encoded = true) String resourceType, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}" + + "/{parentResourcePath}/{resourceType}/{resourceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @PathParam(value = "parentResourcePath", encoded = true) String parentResourcePath, + @PathParam(value = "resourceType", encoded = true) String resourceType, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}" + + "/{parentResourcePath}/{resourceType}/{resourceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @PathParam(value = "parentResourcePath", encoded = true) String parentResourcePath, + @PathParam(value = "resourceType", encoded = true) String resourceType, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") GenericResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}" + + "/{parentResourcePath}/{resourceType}/{resourceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @PathParam(value = "parentResourcePath", encoded = true) String parentResourcePath, + @PathParam(value = "resourceType", encoded = true) String resourceType, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") GenericResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}" + + "/{parentResourcePath}/{resourceType}/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @PathParam(value = "parentResourcePath", encoded = true) String parentResourcePath, + @PathParam(value = "resourceType", encoded = true) String resourceType, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Head("/{resourceId}") + @ExpectedResponses({204, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkExistenceById( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{resourceId}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteById( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{resourceId}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdateById( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GenericResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/{resourceId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateById( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GenericResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getById( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("api-version") String apiVersion, + @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); + + @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 the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) + * or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, + * plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For + * example, to filter by a resource type, use: $filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the + * filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, + * to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', + * name)<br><br>You can link more than one substringof together by adding and/or + * operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name + * and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + * the tags for each resource are not returned in the results.<br><br>You can use some properties + * together when filtering. The combinations you can use are: substringof and/or resourceType, plan and + * plan/publisher and plan/name, identity and identity/principalId. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the resources for a resource group along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter, String expand, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + filter, + expand, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) + * or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, + * plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For + * example, to filter by a resource type, use: $filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the + * filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, + * to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', + * name)<br><br>You can link more than one substringof together by adding and/or + * operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name + * and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + * the tags for each resource are not returned in the results.<br><br>You can use some properties + * together when filtering. The combinations you can use are: substringof and/or resourceType, plan and + * plan/publisher and plan/name, identity and identity/principalId. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns 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 the resources for a resource group along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter, String expand, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + filter, + expand, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) + * or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, + * plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For + * example, to filter by a resource type, use: $filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the + * filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, + * to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', + * name)<br><br>You can link more than one substringof together by adding and/or + * operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name + * and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + * the tags for each resource are not returned in the results.<br><br>You can use some properties + * together when filtering. The combinations you can use are: substringof and/or resourceType, plan and + * plan/publisher and plan/name, identity and identity/principalId. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the resources for a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String filter, String expand, Integer top) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the resources for a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String filter = null; + final String expand = null; + final Integer top = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) + * or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, + * plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For + * example, to filter by a resource type, use: $filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the + * filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, + * to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', + * name)<br><br>You can link more than one substringof together by adding and/or + * operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name + * and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + * the tags for each resource are not returned in the results.<br><br>You can use some properties + * together when filtering. The combinations you can use are: substringof and/or resourceType, plan and + * plan/publisher and plan/name, identity and identity/principalId. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns 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 the resources for a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String filter, String expand, Integer top, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the resources for a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String filter = null; + final String expand = null; + final Integer top = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, expand, top)); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) + * or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, + * plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For + * example, to filter by a resource type, use: $filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the + * filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, + * to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', + * name)<br><br>You can link more than one substringof together by adding and/or + * operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name + * and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + * the tags for each resource are not returned in the results.<br><br>You can use some properties + * together when filtering. The combinations you can use are: substringof and/or resourceType, plan and + * plan/publisher and plan/name, identity and identity/principalId. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns 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 the resources for a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, String expand, Integer top, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, expand, top, context)); + } + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> moveResourcesWithResponseAsync( + String sourceResourceGroupName, ResourcesMoveInfo parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (sourceResourceGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sourceResourceGroupName 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 (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 + .moveResources( + this.client.getEndpoint(), + sourceResourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> moveResourcesWithResponseAsync( + String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (sourceResourceGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sourceResourceGroupName 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 (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 + .moveResources( + this.client.getEndpoint(), + sourceResourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginMoveResourcesAsync( + String sourceResourceGroupName, ResourcesMoveInfo parameters) { + Mono>> mono = moveResourcesWithResponseAsync(sourceResourceGroupName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginMoveResourcesAsync( + String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + moveResourcesWithResponseAsync(sourceResourceGroupName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginMoveResources( + String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return beginMoveResourcesAsync(sourceResourceGroupName, parameters).getSyncPoller(); + } + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginMoveResources( + String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + return beginMoveResourcesAsync(sourceResourceGroupName, parameters, context).getSyncPoller(); + } + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono moveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return beginMoveResourcesAsync(sourceResourceGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono moveResourcesAsync( + String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + return beginMoveResourcesAsync(sourceResourceGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 sourceResourceGroupName, ResourcesMoveInfo parameters) { + moveResourcesAsync(sourceResourceGroupName, parameters).block(); + } + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + moveResourcesAsync(sourceResourceGroupName, parameters, context).block(); + } + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateMoveResourcesWithResponseAsync( + String sourceResourceGroupName, ResourcesMoveInfo parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (sourceResourceGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sourceResourceGroupName 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 (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 + .validateMoveResources( + this.client.getEndpoint(), + sourceResourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateMoveResourcesWithResponseAsync( + String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (sourceResourceGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sourceResourceGroupName 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 (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 + .validateMoveResources( + this.client.getEndpoint(), + sourceResourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginValidateMoveResourcesAsync( + String sourceResourceGroupName, ResourcesMoveInfo parameters) { + Mono>> mono = + validateMoveResourcesWithResponseAsync(sourceResourceGroupName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginValidateMoveResourcesAsync( + String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + validateMoveResourcesWithResponseAsync(sourceResourceGroupName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginValidateMoveResources( + String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return beginValidateMoveResourcesAsync(sourceResourceGroupName, parameters).getSyncPoller(); + } + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginValidateMoveResources( + String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + return beginValidateMoveResourcesAsync(sourceResourceGroupName, parameters, context).getSyncPoller(); + } + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return beginValidateMoveResourcesAsync(sourceResourceGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateMoveResourcesAsync( + String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + return beginValidateMoveResourcesAsync(sourceResourceGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 sourceResourceGroupName, ResourcesMoveInfo parameters) { + validateMoveResourcesAsync(sourceResourceGroupName, parameters).block(); + } + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void validateMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + validateMoveResourcesAsync(sourceResourceGroupName, parameters, context).block(); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>Filter comparison operators include `eq` + * (equals) and `ne` (not equals) and may be used with the following properties: `location`, `resourceType`, + * `name`, `resourceGroup`, `identity`, `identity/principalId`, `plan`, `plan/publisher`, `plan/product`, + * `plan/name`, `plan/version`, and `plan/promotionCode`.<br><br>For example, to filter by a + * resource type, use `$filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'`<br><br><br>`substringof(value, property)` can be used + * to filter for substrings of the following currently-supported properties: `name` and + * `resourceGroup`<br><br>For example, to get all resources with 'demo' anywhere in the resource + * name, use `$filter=substringof('demo', name)`<br><br>Multiple substring operations can also be + * combined using `and`/`or` operators.<br><br>Note that any truncated number of results queried via + * `$top` may also not be compatible when using a filter.<br><br><br>Resources can be filtered + * by tag names and values. For example, to filter for a tag name and value, use `$filter=tagName eq 'tag1' and + * tagValue eq 'Value1'`. Note that when resources are filtered by tag name and value, <b>the original + * tags for each resource will not be returned in the results.</b> Any list of additional properties + * queried via `$expand` may also not be compatible when filtering by tag names/values. <br><br>For + * tag names only, resources can be filtered by prefix using the following syntax: `$filter=startswith(tagName, + * 'depart')`. This query will return all resources with a tag name prefixed by the phrase `depart` + * (i.e.`department`, `departureDate`, `departureTime`, etc.)<br><br><br>Note that some + * properties can be combined when filtering resources, which include the following: `substringof() and/or + * resourceType`, `plan and plan/publisher and plan/name`, and `identity and identity/principalId`. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the resources in a subscription along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String filter, String expand, Integer top) { + 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(), + filter, + expand, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>Filter comparison operators include `eq` + * (equals) and `ne` (not equals) and may be used with the following properties: `location`, `resourceType`, + * `name`, `resourceGroup`, `identity`, `identity/principalId`, `plan`, `plan/publisher`, `plan/product`, + * `plan/name`, `plan/version`, and `plan/promotionCode`.<br><br>For example, to filter by a + * resource type, use `$filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'`<br><br><br>`substringof(value, property)` can be used + * to filter for substrings of the following currently-supported properties: `name` and + * `resourceGroup`<br><br>For example, to get all resources with 'demo' anywhere in the resource + * name, use `$filter=substringof('demo', name)`<br><br>Multiple substring operations can also be + * combined using `and`/`or` operators.<br><br>Note that any truncated number of results queried via + * `$top` may also not be compatible when using a filter.<br><br><br>Resources can be filtered + * by tag names and values. For example, to filter for a tag name and value, use `$filter=tagName eq 'tag1' and + * tagValue eq 'Value1'`. Note that when resources are filtered by tag name and value, <b>the original + * tags for each resource will not be returned in the results.</b> Any list of additional properties + * queried via `$expand` may also not be compatible when filtering by tag names/values. <br><br>For + * tag names only, resources can be filtered by prefix using the following syntax: `$filter=startswith(tagName, + * 'depart')`. This query will return all resources with a tag name prefixed by the phrase `depart` + * (i.e.`department`, `departureDate`, `departureTime`, etc.)<br><br><br>Note that some + * properties can be combined when filtering resources, which include the following: `substringof() and/or + * resourceType`, `plan and plan/publisher and plan/name`, and `identity and identity/principalId`. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns 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 the resources in a subscription along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String filter, String expand, Integer top, 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(), + filter, + expand, + top, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>Filter comparison operators include `eq` + * (equals) and `ne` (not equals) and may be used with the following properties: `location`, `resourceType`, + * `name`, `resourceGroup`, `identity`, `identity/principalId`, `plan`, `plan/publisher`, `plan/product`, + * `plan/name`, `plan/version`, and `plan/promotionCode`.<br><br>For example, to filter by a + * resource type, use `$filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'`<br><br><br>`substringof(value, property)` can be used + * to filter for substrings of the following currently-supported properties: `name` and + * `resourceGroup`<br><br>For example, to get all resources with 'demo' anywhere in the resource + * name, use `$filter=substringof('demo', name)`<br><br>Multiple substring operations can also be + * combined using `and`/`or` operators.<br><br>Note that any truncated number of results queried via + * `$top` may also not be compatible when using a filter.<br><br><br>Resources can be filtered + * by tag names and values. For example, to filter for a tag name and value, use `$filter=tagName eq 'tag1' and + * tagValue eq 'Value1'`. Note that when resources are filtered by tag name and value, <b>the original + * tags for each resource will not be returned in the results.</b> Any list of additional properties + * queried via `$expand` may also not be compatible when filtering by tag names/values. <br><br>For + * tag names only, resources can be filtered by prefix using the following syntax: `$filter=startswith(tagName, + * 'depart')`. This query will return all resources with a tag name prefixed by the phrase `depart` + * (i.e.`department`, `departureDate`, `departureTime`, etc.)<br><br><br>Note that some + * properties can be combined when filtering resources, which include the following: `substringof() and/or + * resourceType`, `plan and plan/publisher and plan/name`, and `identity and identity/principalId`. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 the resources in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String expand, Integer top) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, expand, top), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get all the resources in a 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 all the resources in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + final String expand = null; + final Integer top = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter, expand, top), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>Filter comparison operators include `eq` + * (equals) and `ne` (not equals) and may be used with the following properties: `location`, `resourceType`, + * `name`, `resourceGroup`, `identity`, `identity/principalId`, `plan`, `plan/publisher`, `plan/product`, + * `plan/name`, `plan/version`, and `plan/promotionCode`.<br><br>For example, to filter by a + * resource type, use `$filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'`<br><br><br>`substringof(value, property)` can be used + * to filter for substrings of the following currently-supported properties: `name` and + * `resourceGroup`<br><br>For example, to get all resources with 'demo' anywhere in the resource + * name, use `$filter=substringof('demo', name)`<br><br>Multiple substring operations can also be + * combined using `and`/`or` operators.<br><br>Note that any truncated number of results queried via + * `$top` may also not be compatible when using a filter.<br><br><br>Resources can be filtered + * by tag names and values. For example, to filter for a tag name and value, use `$filter=tagName eq 'tag1' and + * tagValue eq 'Value1'`. Note that when resources are filtered by tag name and value, <b>the original + * tags for each resource will not be returned in the results.</b> Any list of additional properties + * queried via `$expand` may also not be compatible when filtering by tag names/values. <br><br>For + * tag names only, resources can be filtered by prefix using the following syntax: `$filter=startswith(tagName, + * 'depart')`. This query will return all resources with a tag name prefixed by the phrase `depart` + * (i.e.`department`, `departureDate`, `departureTime`, etc.)<br><br><br>Note that some + * properties can be combined when filtering resources, which include the following: `substringof() and/or + * resourceType`, `plan and plan/publisher and plan/name`, and `identity and identity/principalId`. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns 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 the resources in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String filter, String expand, Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, expand, top, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all the resources in a 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 all the resources in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + final String expand = null; + final Integer top = null; + return new PagedIterable<>(listAsync(filter, expand, top)); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>Filter comparison operators include `eq` + * (equals) and `ne` (not equals) and may be used with the following properties: `location`, `resourceType`, + * `name`, `resourceGroup`, `identity`, `identity/principalId`, `plan`, `plan/publisher`, `plan/product`, + * `plan/name`, `plan/version`, and `plan/promotionCode`.<br><br>For example, to filter by a + * resource type, use `$filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'`<br><br><br>`substringof(value, property)` can be used + * to filter for substrings of the following currently-supported properties: `name` and + * `resourceGroup`<br><br>For example, to get all resources with 'demo' anywhere in the resource + * name, use `$filter=substringof('demo', name)`<br><br>Multiple substring operations can also be + * combined using `and`/`or` operators.<br><br>Note that any truncated number of results queried via + * `$top` may also not be compatible when using a filter.<br><br><br>Resources can be filtered + * by tag names and values. For example, to filter for a tag name and value, use `$filter=tagName eq 'tag1' and + * tagValue eq 'Value1'`. Note that when resources are filtered by tag name and value, <b>the original + * tags for each resource will not be returned in the results.</b> Any list of additional properties + * queried via `$expand` may also not be compatible when filtering by tag names/values. <br><br>For + * tag names only, resources can be filtered by prefix using the following syntax: `$filter=startswith(tagName, + * 'depart')`. This query will return all resources with a tag name prefixed by the phrase `depart` + * (i.e.`department`, `departureDate`, `departureTime`, etc.)<br><br><br>Note that some + * properties can be combined when filtering resources, which include the following: `substringof() and/or + * resourceType`, `plan and plan/publisher and plan/name`, and `identity and identity/principalId`. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns 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 the resources in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String filter, String expand, Integer top, Context context) { + return new PagedIterable<>(listAsync(filter, expand, top, context)); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case + * insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the 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 whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceWithResponseAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 + .checkExistence( + this.client.getEndpoint(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case + * insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the 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 whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceWithResponseAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 + .checkExistence( + this.client.getEndpoint(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case + * insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the 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 whether resource exists on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkExistenceAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + return checkExistenceWithResponseAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case + * insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the 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 whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean checkExistence( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + Boolean value = + checkExistenceAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion) + .block(); + if (value != null) { + return value; + } else { + throw logger.logExceptionAsError(new NullPointerException()); + } + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case + * insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the 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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkExistenceWithResponse( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + return checkExistenceWithResponseAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + context) + .block(); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + return beginDeleteAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion) + .getSyncPoller(); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + return beginDeleteAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + context) + .getSyncPoller(); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + return beginDeleteAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + return beginDeleteAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the 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 resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + deleteAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion) + .block(); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the 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 resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + deleteAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + context) + .block(); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating 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 resource information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 (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(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating 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 resource information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 (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(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GenericResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GenericResourceInner.class, + GenericResourceInner.class, + this.client.getContext()); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GenericResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters, + context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GenericResourceInner.class, GenericResourceInner.class, context); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GenericResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters) + .getSyncPoller(); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GenericResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters, + context) + .getSyncPoller(); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating 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 resource information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating 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 resource information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating 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 resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenericResourceInner createOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + return createOrUpdateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters) + .block(); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating 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 resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenericResourceInner createOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters, + context) + .block(); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating 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 resource information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 (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(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating 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 resource information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 (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(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GenericResourceInner> beginUpdateAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GenericResourceInner.class, + GenericResourceInner.class, + this.client.getContext()); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GenericResourceInner> beginUpdateAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters, + context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GenericResourceInner.class, GenericResourceInner.class, context); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GenericResourceInner> beginUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + return beginUpdateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters) + .getSyncPoller(); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GenericResourceInner> beginUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters, + context) + .getSyncPoller(); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating 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 resource information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + return beginUpdateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating 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 resource information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating 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 resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenericResourceInner update( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + return updateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters) + .block(); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating 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 resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenericResourceInner update( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + return updateAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters, + context) + .block(); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + return getWithResponseAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenericResourceInner get( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + return getAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion) + .block(); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + return getWithResponseAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + context) + .block(); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceByIdWithResponseAsync(String resourceId, String apiVersion) { + 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 (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.checkExistenceById(this.client.getEndpoint(), resourceId, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkExistenceByIdWithResponseAsync( + String resourceId, String apiVersion, 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 (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.checkExistenceById(this.client.getEndpoint(), resourceId, apiVersion, accept, context); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 whether resource exists on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkExistenceByIdAsync(String resourceId, String apiVersion) { + return checkExistenceByIdWithResponseAsync(resourceId, apiVersion) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean checkExistenceById(String resourceId, String apiVersion) { + Boolean value = checkExistenceByIdAsync(resourceId, apiVersion).block(); + if (value != null) { + return value; + } else { + throw logger.logExceptionAsError(new NullPointerException()); + } + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkExistenceByIdWithResponse(String resourceId, String apiVersion, Context context) { + return checkExistenceByIdWithResponseAsync(resourceId, apiVersion, context).block(); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteByIdWithResponseAsync(String resourceId, String apiVersion) { + 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 (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.deleteById(this.client.getEndpoint(), resourceId, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteByIdWithResponseAsync( + String resourceId, String apiVersion, 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 (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.deleteById(this.client.getEndpoint(), resourceId, apiVersion, accept, context); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteByIdAsync(String resourceId, String apiVersion) { + Mono>> mono = deleteByIdWithResponseAsync(resourceId, apiVersion); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteByIdAsync( + String resourceId, String apiVersion, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteByIdWithResponseAsync(resourceId, apiVersion, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteById(String resourceId, String apiVersion) { + return beginDeleteByIdAsync(resourceId, apiVersion).getSyncPoller(); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteById(String resourceId, String apiVersion, Context context) { + return beginDeleteByIdAsync(resourceId, apiVersion, context).getSyncPoller(); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByIdAsync(String resourceId, String apiVersion) { + return beginDeleteByIdAsync(resourceId, apiVersion).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByIdAsync(String resourceId, String apiVersion, Context context) { + return beginDeleteByIdAsync(resourceId, apiVersion, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 deleteById(String resourceId, String apiVersion) { + deleteByIdAsync(resourceId, apiVersion).block(); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 deleteById(String resourceId, String apiVersion, Context context) { + deleteByIdAsync(resourceId, apiVersion, context).block(); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateByIdWithResponseAsync( + String resourceId, String apiVersion, GenericResourceInner 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 (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 + .createOrUpdateById( + this.client.getEndpoint(), resourceId, apiVersion, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateByIdWithResponseAsync( + String resourceId, String apiVersion, GenericResourceInner 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 (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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 + .createOrUpdateById(this.client.getEndpoint(), resourceId, apiVersion, parameters, accept, context); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GenericResourceInner> beginCreateOrUpdateByIdAsync( + String resourceId, String apiVersion, GenericResourceInner parameters) { + Mono>> mono = createOrUpdateByIdWithResponseAsync(resourceId, apiVersion, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GenericResourceInner.class, + GenericResourceInner.class, + this.client.getContext()); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GenericResourceInner> beginCreateOrUpdateByIdAsync( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateByIdWithResponseAsync(resourceId, apiVersion, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GenericResourceInner.class, GenericResourceInner.class, context); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GenericResourceInner> beginCreateOrUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginCreateOrUpdateByIdAsync(resourceId, apiVersion, parameters).getSyncPoller(); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GenericResourceInner> beginCreateOrUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context) { + return beginCreateOrUpdateByIdAsync(resourceId, apiVersion, parameters, context).getSyncPoller(); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateByIdAsync( + String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginCreateOrUpdateByIdAsync(resourceId, apiVersion, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateByIdAsync( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context) { + return beginCreateOrUpdateByIdAsync(resourceId, apiVersion, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenericResourceInner createOrUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters) { + return createOrUpdateByIdAsync(resourceId, apiVersion, parameters).block(); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenericResourceInner createOrUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context) { + return createOrUpdateByIdAsync(resourceId, apiVersion, parameters, context).block(); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateByIdWithResponseAsync( + String resourceId, String apiVersion, GenericResourceInner 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 (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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.updateById(this.client.getEndpoint(), resourceId, apiVersion, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateByIdWithResponseAsync( + String resourceId, String apiVersion, GenericResourceInner 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 (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion 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.updateById(this.client.getEndpoint(), resourceId, apiVersion, parameters, accept, context); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GenericResourceInner> beginUpdateByIdAsync( + String resourceId, String apiVersion, GenericResourceInner parameters) { + Mono>> mono = updateByIdWithResponseAsync(resourceId, apiVersion, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GenericResourceInner.class, + GenericResourceInner.class, + this.client.getContext()); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GenericResourceInner> beginUpdateByIdAsync( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateByIdWithResponseAsync(resourceId, apiVersion, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GenericResourceInner.class, GenericResourceInner.class, context); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GenericResourceInner> beginUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginUpdateByIdAsync(resourceId, apiVersion, parameters).getSyncPoller(); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GenericResourceInner> beginUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context) { + return beginUpdateByIdAsync(resourceId, apiVersion, parameters, context).getSyncPoller(); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateByIdAsync( + String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginUpdateByIdAsync(resourceId, apiVersion, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateByIdAsync( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context) { + return beginUpdateByIdAsync(resourceId, apiVersion, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenericResourceInner updateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + return updateByIdAsync(resourceId, apiVersion, parameters).block(); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenericResourceInner updateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context) { + return updateByIdAsync(resourceId, apiVersion, parameters, context).block(); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource by ID along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByIdWithResponseAsync(String resourceId, String apiVersion) { + 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 (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getById(this.client.getEndpoint(), resourceId, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource by ID along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByIdWithResponseAsync( + String resourceId, String apiVersion, 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 (apiVersion == null) { + return Mono.error(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getById(this.client.getEndpoint(), resourceId, apiVersion, accept, context); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource by ID on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByIdAsync(String resourceId, String apiVersion) { + return getByIdWithResponseAsync(resourceId, apiVersion) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenericResourceInner getById(String resourceId, String apiVersion) { + return getByIdAsync(resourceId, apiVersion).block(); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource by ID along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByIdWithResponse(String resourceId, String apiVersion, Context context) { + return getByIdWithResponseAsync(resourceId, apiVersion, 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 list of resource groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of resource groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 list of resource groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of resource groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourcesImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourcesImpl.java new file mode 100644 index 0000000000000..d2e360977feb2 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/ResourcesImpl.java @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.ResourcesClient; +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceExpandedInner; +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceInner; +import com.azure.resourcemanager.resources.generated.models.GenericResource; +import com.azure.resourcemanager.resources.generated.models.GenericResourceExpanded; +import com.azure.resourcemanager.resources.generated.models.Resources; +import com.azure.resourcemanager.resources.generated.models.ResourcesMoveInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourcesImpl implements Resources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourcesImpl.class); + + private final ResourcesClient innerClient; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + public ResourcesImpl( + ResourcesClient innerClient, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new GenericResourceExpandedImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, String expand, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, filter, expand, top, context); + return Utils.mapPage(inner, inner1 -> new GenericResourceExpandedImpl(inner1, this.manager())); + } + + public void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + this.serviceClient().moveResources(sourceResourceGroupName, parameters); + } + + public void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + this.serviceClient().moveResources(sourceResourceGroupName, parameters, context); + } + + public void validateMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + this.serviceClient().validateMoveResources(sourceResourceGroupName, parameters); + } + + public void validateMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context) { + this.serviceClient().validateMoveResources(sourceResourceGroupName, parameters, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new GenericResourceExpandedImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, String expand, Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(filter, expand, top, context); + return Utils.mapPage(inner, inner1 -> new GenericResourceExpandedImpl(inner1, this.manager())); + } + + public boolean checkExistence( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + return this + .serviceClient() + .checkExistence( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion); + } + + public Response checkExistenceWithResponse( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + return this + .serviceClient() + .checkExistenceWithResponse( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + context); + } + + public void delete( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + this + .serviceClient() + .delete( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion); + } + + public void delete( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + this + .serviceClient() + .delete( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + context); + } + + public GenericResource createOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + GenericResourceInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters); + if (inner != null) { + return new GenericResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public GenericResource createOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + GenericResourceInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters, + context); + if (inner != null) { + return new GenericResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public GenericResource update( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters) { + GenericResourceInner inner = + this + .serviceClient() + .update( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters); + if (inner != null) { + return new GenericResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public GenericResource update( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context) { + GenericResourceInner inner = + this + .serviceClient() + .update( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + parameters, + context); + if (inner != null) { + return new GenericResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public GenericResource get( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion) { + GenericResourceInner inner = + this + .serviceClient() + .get( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion); + if (inner != null) { + return new GenericResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + apiVersion, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GenericResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public boolean checkExistenceById(String resourceId, String apiVersion) { + return this.serviceClient().checkExistenceById(resourceId, apiVersion); + } + + public Response checkExistenceByIdWithResponse(String resourceId, String apiVersion, Context context) { + return this.serviceClient().checkExistenceByIdWithResponse(resourceId, apiVersion, context); + } + + public void deleteById(String resourceId, String apiVersion) { + this.serviceClient().deleteById(resourceId, apiVersion); + } + + public void deleteById(String resourceId, String apiVersion, Context context) { + this.serviceClient().deleteById(resourceId, apiVersion, context); + } + + public GenericResource createOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + GenericResourceInner inner = this.serviceClient().createOrUpdateById(resourceId, apiVersion, parameters); + if (inner != null) { + return new GenericResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public GenericResource createOrUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context) { + GenericResourceInner inner = + this.serviceClient().createOrUpdateById(resourceId, apiVersion, parameters, context); + if (inner != null) { + return new GenericResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public GenericResource updateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + GenericResourceInner inner = this.serviceClient().updateById(resourceId, apiVersion, parameters); + if (inner != null) { + return new GenericResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public GenericResource updateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context) { + GenericResourceInner inner = this.serviceClient().updateById(resourceId, apiVersion, parameters, context); + if (inner != null) { + return new GenericResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public GenericResource getById(String resourceId, String apiVersion) { + GenericResourceInner inner = this.serviceClient().getById(resourceId, apiVersion); + if (inner != null) { + return new GenericResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByIdWithResponse(String resourceId, String apiVersion, Context context) { + Response inner = + this.serviceClient().getByIdWithResponse(resourceId, apiVersion, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GenericResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagDetailsImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagDetailsImpl.java new file mode 100644 index 0000000000000..837a8a12d37c1 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagDetailsImpl.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.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.TagDetailsInner; +import com.azure.resourcemanager.resources.generated.fluent.models.TagValueInner; +import com.azure.resourcemanager.resources.generated.models.TagCount; +import com.azure.resourcemanager.resources.generated.models.TagDetails; +import com.azure.resourcemanager.resources.generated.models.TagValue; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class TagDetailsImpl implements TagDetails { + private TagDetailsInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + TagDetailsImpl( + TagDetailsInner innerObject, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String tagName() { + return this.innerModel().tagName(); + } + + public TagCount count() { + return this.innerModel().count(); + } + + public List values() { + List inner = this.innerModel().values(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new TagValueImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public TagDetailsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagOperationsClientImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagOperationsClientImpl.java new file mode 100644 index 0000000000000..21586be4aa48b --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagOperationsClientImpl.java @@ -0,0 +1,1458 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.fluent.TagOperationsClient; +import com.azure.resourcemanager.resources.generated.fluent.models.TagDetailsInner; +import com.azure.resourcemanager.resources.generated.fluent.models.TagValueInner; +import com.azure.resourcemanager.resources.generated.fluent.models.TagsResourceInner; +import com.azure.resourcemanager.resources.generated.models.TagsListResult; +import com.azure.resourcemanager.resources.generated.models.TagsPatchResource; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TagOperationsClient. */ +public final class TagOperationsClientImpl implements TagOperationsClient { + private final ClientLogger logger = new ClientLogger(TagOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TagOperationsService service; + + /** The service client containing this operation class. */ + private final ResourceManagementClientImpl client; + + /** + * Initializes an instance of TagOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TagOperationsClientImpl(ResourceManagementClientImpl client) { + this.service = + RestProxy.create(TagOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourceManagementClientTagOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ResourceManagementCl") + private interface TagOperationsService { + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteValue( + @HostParam("$host") String endpoint, + @PathParam("tagName") String tagName, + @PathParam("tagValue") String tagValue, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdateValue( + @HostParam("$host") String endpoint, + @PathParam("tagName") String tagName, + @PathParam("tagValue") String tagValue, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/tagNames/{tagName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("tagName") String tagName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/tagNames/{tagName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("tagName") String tagName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/tagNames") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.Resources/tags/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdateAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TagsResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/{scope}/providers/Microsoft.Resources/tags/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TagsPatchResource parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Resources/tags/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{scope}/providers/Microsoft.Resources/tags/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteAtScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @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); + } + + /** + * This operation allows deleting a value from the list of predefined values for an existing predefined tag name. + * The value being deleted must not be in use as a tag value for the given tag name for any resource. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteValueWithResponseAsync(String tagName, String tagValue) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (tagName == null) { + return Mono.error(new IllegalArgumentException("Parameter tagName is required and cannot be null.")); + } + if (tagValue == null) { + return Mono.error(new IllegalArgumentException("Parameter tagValue 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 + .deleteValue( + this.client.getEndpoint(), + tagName, + tagValue, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This operation allows deleting a value from the list of predefined values for an existing predefined tag name. + * The value being deleted must not be in use as a tag value for the given tag name for any resource. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteValueWithResponseAsync(String tagName, String tagValue, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (tagName == null) { + return Mono.error(new IllegalArgumentException("Parameter tagName is required and cannot be null.")); + } + if (tagValue == null) { + return Mono.error(new IllegalArgumentException("Parameter tagValue 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 + .deleteValue( + this.client.getEndpoint(), + tagName, + tagValue, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * This operation allows deleting a value from the list of predefined values for an existing predefined tag name. + * The value being deleted must not be in use as a tag value for the given tag name for any resource. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteValueAsync(String tagName, String tagValue) { + return deleteValueWithResponseAsync(tagName, tagValue).flatMap((Response res) -> Mono.empty()); + } + + /** + * This operation allows deleting a value from the list of predefined values for an existing predefined tag name. + * The value being deleted must not be in use as a tag value for the given tag name for any resource. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteValue(String tagName, String tagValue) { + deleteValueAsync(tagName, tagValue).block(); + } + + /** + * This operation allows deleting a value from the list of predefined values for an existing predefined tag name. + * The value being deleted must not be in use as a tag value for the given tag name for any resource. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteValueWithResponse(String tagName, String tagValue, Context context) { + return deleteValueWithResponseAsync(tagName, tagValue, context).block(); + } + + /** + * This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag + * value can have a maximum of 256 characters. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tag information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateValueWithResponseAsync(String tagName, String tagValue) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (tagName == null) { + return Mono.error(new IllegalArgumentException("Parameter tagName is required and cannot be null.")); + } + if (tagValue == null) { + return Mono.error(new IllegalArgumentException("Parameter tagValue 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 + .createOrUpdateValue( + this.client.getEndpoint(), + tagName, + tagValue, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag + * value can have a maximum of 256 characters. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 tag information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateValueWithResponseAsync( + String tagName, String tagValue, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (tagName == null) { + return Mono.error(new IllegalArgumentException("Parameter tagName is required and cannot be null.")); + } + if (tagValue == null) { + return Mono.error(new IllegalArgumentException("Parameter tagValue 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 + .createOrUpdateValue( + this.client.getEndpoint(), + tagName, + tagValue, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag + * value can have a maximum of 256 characters. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tag information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateValueAsync(String tagName, String tagValue) { + return createOrUpdateValueWithResponseAsync(tagName, tagValue) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag + * value can have a maximum of 256 characters. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tag information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagValueInner createOrUpdateValue(String tagName, String tagValue) { + return createOrUpdateValueAsync(tagName, tagValue).block(); + } + + /** + * This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag + * value can have a maximum of 256 characters. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 tag information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateValueWithResponse(String tagName, String tagValue, Context context) { + return createOrUpdateValueWithResponseAsync(tagName, tagValue, context).block(); + } + + /** + * This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name + * can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which + * are reserved for Azure use: 'microsoft', 'azure', 'windows'. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tag details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String tagName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (tagName == null) { + return Mono.error(new IllegalArgumentException("Parameter tagName 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 + .createOrUpdate( + this.client.getEndpoint(), + tagName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name + * can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which + * are reserved for Azure use: 'microsoft', 'azure', 'windows'. + * + * @param tagName The name of the tag to create. + * @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 tag details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String tagName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (tagName == null) { + return Mono.error(new IllegalArgumentException("Parameter tagName 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 + .createOrUpdate( + this.client.getEndpoint(), + tagName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name + * can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which + * are reserved for Azure use: 'microsoft', 'azure', 'windows'. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tag details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String tagName) { + return createOrUpdateWithResponseAsync(tagName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name + * can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which + * are reserved for Azure use: 'microsoft', 'azure', 'windows'. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tag details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagDetailsInner createOrUpdate(String tagName) { + return createOrUpdateAsync(tagName).block(); + } + + /** + * This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name + * can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which + * are reserved for Azure use: 'microsoft', 'azure', 'windows'. + * + * @param tagName The name of the tag to create. + * @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 tag details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String tagName, Context context) { + return createOrUpdateWithResponseAsync(tagName, context).block(); + } + + /** + * This operation allows deleting a name from the list of predefined tag names for the given subscription. The name + * being deleted must not be in use as a tag name for any resource. All predefined values for the given name must + * have already been deleted. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String tagName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (tagName == null) { + return Mono.error(new IllegalArgumentException("Parameter tagName 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 + .delete( + this.client.getEndpoint(), + tagName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This operation allows deleting a name from the list of predefined tag names for the given subscription. The name + * being deleted must not be in use as a tag name for any resource. All predefined values for the given name must + * have already been deleted. + * + * @param tagName The name of the tag. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String tagName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (tagName == null) { + return Mono.error(new IllegalArgumentException("Parameter tagName 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 + .delete( + this.client.getEndpoint(), + tagName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * This operation allows deleting a name from the list of predefined tag names for the given subscription. The name + * being deleted must not be in use as a tag name for any resource. All predefined values for the given name must + * have already been deleted. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String tagName) { + return deleteWithResponseAsync(tagName).flatMap((Response res) -> Mono.empty()); + } + + /** + * This operation allows deleting a name from the list of predefined tag names for the given subscription. The name + * being deleted must not be in use as a tag name for any resource. All predefined values for the given name must + * have already been deleted. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 tagName) { + deleteAsync(tagName).block(); + } + + /** + * This operation allows deleting a name from the list of predefined tag names for the given subscription. The name + * being deleted must not be in use as a tag name for any resource. All predefined values for the given name must + * have already been deleted. + * + * @param tagName The name of the tag. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String tagName, Context context) { + return deleteWithResponseAsync(tagName, context).block(); + } + + /** + * This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and + * returns a summary of usage for each tag name and value under the given subscription. In case of a large number of + * tags, this operation may return a previously cached result. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of subscription tags along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and + * returns a summary of usage for each tag name and value under the given subscription. In case of a large number of + * tags, this operation may return a previously cached result. + * + * @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 list of subscription tags along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and + * returns a summary of usage for each tag name and value under the given subscription. In case of a large number of + * tags, this operation may return a previously cached result. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of subscription tags as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and + * returns a summary of usage for each tag name and value under the given subscription. In case of a large number of + * tags, this operation may return a previously cached result. + * + * @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 list of subscription tags as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and + * returns a summary of usage for each tag name and value under the given subscription. In case of a large number of + * tags, this operation may return a previously cached result. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of subscription tags as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and + * returns a summary of usage for each tag name and value under the given subscription. In case of a large number of + * tags, this operation may return a previously cached result. + * + * @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 list of subscription tags as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The + * specified entity can have a maximum of 50 tags. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags API requests and responses. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return wrapper resource for tags API requests and responses along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAtScopeWithResponseAsync( + String scope, TagsResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope 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 + .createOrUpdateAtScope( + this.client.getEndpoint(), scope, this.client.getApiVersion(), parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The + * specified entity can have a maximum of 50 tags. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags API requests and responses. + * @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 wrapper resource for tags API requests and responses along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAtScopeWithResponseAsync( + String scope, TagsResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope 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 + .createOrUpdateAtScope( + this.client.getEndpoint(), scope, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The + * specified entity can have a maximum of 50 tags. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags API requests and responses. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return wrapper resource for tags API requests and responses on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtScopeAsync(String scope, TagsResourceInner parameters) { + return createOrUpdateAtScopeWithResponseAsync(scope, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The + * specified entity can have a maximum of 50 tags. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags API requests and responses. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return wrapper resource for tags API requests and responses. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagsResourceInner createOrUpdateAtScope(String scope, TagsResourceInner parameters) { + return createOrUpdateAtScopeAsync(scope, parameters).block(); + } + + /** + * This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The + * specified entity can have a maximum of 50 tags. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags API requests and responses. + * @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 wrapper resource for tags API requests and responses along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateAtScopeWithResponse( + String scope, TagsResourceInner parameters, Context context) { + return createOrUpdateAtScopeWithResponseAsync(scope, parameters, context).block(); + } + + /** + * This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. + * The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the + * entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the + * values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or + * name/value pairs. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags patch API request only. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return wrapper resource for tags API requests and responses along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateAtScopeWithResponseAsync( + String scope, TagsPatchResource parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope 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 + .updateAtScope( + this.client.getEndpoint(), scope, this.client.getApiVersion(), parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. + * The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the + * entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the + * values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or + * name/value pairs. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags patch API request only. + * @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 wrapper resource for tags API requests and responses along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateAtScopeWithResponseAsync( + String scope, TagsPatchResource parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope 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 + .updateAtScope(this.client.getEndpoint(), scope, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. + * The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the + * entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the + * values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or + * name/value pairs. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags patch API request only. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return wrapper resource for tags API requests and responses on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAtScopeAsync(String scope, TagsPatchResource parameters) { + return updateAtScopeWithResponseAsync(scope, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. + * The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the + * entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the + * values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or + * name/value pairs. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags patch API request only. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return wrapper resource for tags API requests and responses. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagsResourceInner updateAtScope(String scope, TagsPatchResource parameters) { + return updateAtScopeAsync(scope, parameters).block(); + } + + /** + * This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. + * The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the + * entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the + * values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or + * name/value pairs. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags patch API request only. + * @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 wrapper resource for tags API requests and responses along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateAtScopeWithResponse( + String scope, TagsPatchResource parameters, Context context) { + return updateAtScopeWithResponseAsync(scope, parameters, context).block(); + } + + /** + * Gets the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 entire set of tags on a resource or subscription along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtScopeWithResponseAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.getAtScope(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @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 entire set of tags on a resource or subscription along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtScopeWithResponseAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getAtScope(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 entire set of tags on a resource or subscription on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtScopeAsync(String scope) { + return getAtScopeWithResponseAsync(scope) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 entire set of tags on a resource or subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagsResourceInner getAtScope(String scope) { + return getAtScopeAsync(scope).block(); + } + + /** + * Gets the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @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 entire set of tags on a resource or subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtScopeWithResponse(String scope, Context context) { + return getAtScopeWithResponseAsync(scope, context).block(); + } + + /** + * Deletes the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtScopeWithResponseAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteAtScope(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtScopeWithResponseAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.deleteAtScope(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtScopeAsync(String scope) { + return deleteAtScopeWithResponseAsync(scope).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteAtScope(String scope) { + deleteAtScopeAsync(scope).block(); + } + + /** + * Deletes the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAtScopeWithResponse(String scope, Context context) { + return deleteAtScopeWithResponseAsync(scope, 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 list of subscription tags along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of subscription tags along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagOperationsImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagOperationsImpl.java new file mode 100644 index 0000000000000..8c9210308ef3a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagOperationsImpl.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.resources.generated.fluent.TagOperationsClient; +import com.azure.resourcemanager.resources.generated.fluent.models.TagDetailsInner; +import com.azure.resourcemanager.resources.generated.fluent.models.TagValueInner; +import com.azure.resourcemanager.resources.generated.fluent.models.TagsResourceInner; +import com.azure.resourcemanager.resources.generated.models.TagDetails; +import com.azure.resourcemanager.resources.generated.models.TagOperations; +import com.azure.resourcemanager.resources.generated.models.TagValue; +import com.azure.resourcemanager.resources.generated.models.TagsPatchResource; +import com.azure.resourcemanager.resources.generated.models.TagsResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TagOperationsImpl implements TagOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagOperationsImpl.class); + + private final TagOperationsClient innerClient; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + public TagOperationsImpl( + TagOperationsClient innerClient, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteValue(String tagName, String tagValue) { + this.serviceClient().deleteValue(tagName, tagValue); + } + + public Response deleteValueWithResponse(String tagName, String tagValue, Context context) { + return this.serviceClient().deleteValueWithResponse(tagName, tagValue, context); + } + + public TagValue createOrUpdateValue(String tagName, String tagValue) { + TagValueInner inner = this.serviceClient().createOrUpdateValue(tagName, tagValue); + if (inner != null) { + return new TagValueImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateValueWithResponse(String tagName, String tagValue, Context context) { + Response inner = + this.serviceClient().createOrUpdateValueWithResponse(tagName, tagValue, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TagValueImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TagDetails createOrUpdate(String tagName) { + TagDetailsInner inner = this.serviceClient().createOrUpdate(tagName); + if (inner != null) { + return new TagDetailsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse(String tagName, Context context) { + Response inner = this.serviceClient().createOrUpdateWithResponse(tagName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TagDetailsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String tagName) { + this.serviceClient().delete(tagName); + } + + public Response deleteWithResponse(String tagName, Context context) { + return this.serviceClient().deleteWithResponse(tagName, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new TagDetailsImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new TagDetailsImpl(inner1, this.manager())); + } + + public TagsResource createOrUpdateAtScope(String scope, TagsResourceInner parameters) { + TagsResourceInner inner = this.serviceClient().createOrUpdateAtScope(scope, parameters); + if (inner != null) { + return new TagsResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateAtScopeWithResponse( + String scope, TagsResourceInner parameters, Context context) { + Response inner = + this.serviceClient().createOrUpdateAtScopeWithResponse(scope, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TagsResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TagsResource updateAtScope(String scope, TagsPatchResource parameters) { + TagsResourceInner inner = this.serviceClient().updateAtScope(scope, parameters); + if (inner != null) { + return new TagsResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateAtScopeWithResponse( + String scope, TagsPatchResource parameters, Context context) { + Response inner = this.serviceClient().updateAtScopeWithResponse(scope, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TagsResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TagsResource getAtScope(String scope) { + TagsResourceInner inner = this.serviceClient().getAtScope(scope); + if (inner != null) { + return new TagsResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtScopeWithResponse(String scope, Context context) { + Response inner = this.serviceClient().getAtScopeWithResponse(scope, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TagsResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteAtScope(String scope) { + this.serviceClient().deleteAtScope(scope); + } + + public Response deleteAtScopeWithResponse(String scope, Context context) { + return this.serviceClient().deleteAtScopeWithResponse(scope, context); + } + + private TagOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagValueImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagValueImpl.java new file mode 100644 index 0000000000000..e2e6ceb6b6d5f --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagValueImpl.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.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.TagValueInner; +import com.azure.resourcemanager.resources.generated.models.TagCount; +import com.azure.resourcemanager.resources.generated.models.TagValue; + +public final class TagValueImpl implements TagValue { + private TagValueInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + TagValueImpl( + TagValueInner innerObject, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String tagValue() { + return this.innerModel().tagValue(); + } + + public TagCount count() { + return this.innerModel().count(); + } + + public TagValueInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagsResourceImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagsResourceImpl.java new file mode 100644 index 0000000000000..a9867e4e317b0 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TagsResourceImpl.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.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.TagsResourceInner; +import com.azure.resourcemanager.resources.generated.models.Tags; +import com.azure.resourcemanager.resources.generated.models.TagsResource; + +public final class TagsResourceImpl implements TagsResource { + private TagsResourceInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + TagsResourceImpl( + TagsResourceInner innerObject, com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Tags properties() { + return this.innerModel().properties(); + } + + public TagsResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TemplateHashResultImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TemplateHashResultImpl.java new file mode 100644 index 0000000000000..4e3fe9bbac996 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/TemplateHashResultImpl.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.resources.generated.implementation; + +import com.azure.resourcemanager.resources.generated.fluent.models.TemplateHashResultInner; +import com.azure.resourcemanager.resources.generated.models.TemplateHashResult; + +public final class TemplateHashResultImpl implements TemplateHashResult { + private TemplateHashResultInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + TemplateHashResultImpl( + TemplateHashResultInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String minifiedTemplate() { + return this.innerModel().minifiedTemplate(); + } + + public String templateHash() { + return this.innerModel().templateHash(); + } + + public TemplateHashResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/Utils.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/Utils.java new file mode 100644 index 0000000000000..bef23cff96340 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/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.resources.generated.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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/WhatIfOperationResultImpl.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/WhatIfOperationResultImpl.java new file mode 100644 index 0000000000000..d0832da2e7204 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/WhatIfOperationResultImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.resources.generated.fluent.models.WhatIfOperationResultInner; +import com.azure.resourcemanager.resources.generated.models.WhatIfChange; +import com.azure.resourcemanager.resources.generated.models.WhatIfOperationResult; +import java.util.Collections; +import java.util.List; + +public final class WhatIfOperationResultImpl implements WhatIfOperationResult { + private WhatIfOperationResultInner innerObject; + + private final com.azure.resourcemanager.resources.generated.ResourceManager serviceManager; + + WhatIfOperationResultImpl( + WhatIfOperationResultInner innerObject, + com.azure.resourcemanager.resources.generated.ResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String status() { + return this.innerModel().status(); + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public List changes() { + List inner = this.innerModel().changes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public WhatIfOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resources.generated.ResourceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/package-info.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/package-info.java new file mode 100644 index 0000000000000..310c775cade01 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for ResourceManagementClient. Provides operations for working with resources + * and resource groups. + */ +package com.azure.resourcemanager.resources.generated.implementation; diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Alias.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Alias.java new file mode 100644 index 0000000000000..db909fdb48ba4 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Alias.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** The alias type. */ +@Fluent +public final class Alias { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Alias.class); + + /* + * The alias name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The paths for an alias. + */ + @JsonProperty(value = "paths") + private List paths; + + /* + * The type of the alias. + */ + @JsonProperty(value = "type") + private AliasType type; + + /* + * The default path for an alias. + */ + @JsonProperty(value = "defaultPath") + private String defaultPath; + + /* + * The default pattern for an alias. + */ + @JsonProperty(value = "defaultPattern") + private AliasPattern defaultPattern; + + /* + * The default alias path metadata. Applies to the default path and to any + * alias path that doesn't have metadata + */ + @JsonProperty(value = "defaultMetadata", access = JsonProperty.Access.WRITE_ONLY) + private AliasPathMetadata defaultMetadata; + + /** + * Get the name property: The alias name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The alias name. + * + * @param name the name value to set. + * @return the Alias object itself. + */ + public Alias withName(String name) { + this.name = name; + return this; + } + + /** + * Get the paths property: The paths for an alias. + * + * @return the paths value. + */ + public List paths() { + return this.paths; + } + + /** + * Set the paths property: The paths for an alias. + * + * @param paths the paths value to set. + * @return the Alias object itself. + */ + public Alias withPaths(List paths) { + this.paths = paths; + return this; + } + + /** + * Get the type property: The type of the alias. + * + * @return the type value. + */ + public AliasType type() { + return this.type; + } + + /** + * Set the type property: The type of the alias. + * + * @param type the type value to set. + * @return the Alias object itself. + */ + public Alias withType(AliasType type) { + this.type = type; + return this; + } + + /** + * Get the defaultPath property: The default path for an alias. + * + * @return the defaultPath value. + */ + public String defaultPath() { + return this.defaultPath; + } + + /** + * Set the defaultPath property: The default path for an alias. + * + * @param defaultPath the defaultPath value to set. + * @return the Alias object itself. + */ + public Alias withDefaultPath(String defaultPath) { + this.defaultPath = defaultPath; + return this; + } + + /** + * Get the defaultPattern property: The default pattern for an alias. + * + * @return the defaultPattern value. + */ + public AliasPattern defaultPattern() { + return this.defaultPattern; + } + + /** + * Set the defaultPattern property: The default pattern for an alias. + * + * @param defaultPattern the defaultPattern value to set. + * @return the Alias object itself. + */ + public Alias withDefaultPattern(AliasPattern defaultPattern) { + this.defaultPattern = defaultPattern; + return this; + } + + /** + * Get the defaultMetadata property: The default alias path metadata. Applies to the default path and to any alias + * path that doesn't have metadata. + * + * @return the defaultMetadata value. + */ + public AliasPathMetadata defaultMetadata() { + return this.defaultMetadata; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (paths() != null) { + paths().forEach(e -> e.validate()); + } + if (defaultPattern() != null) { + defaultPattern().validate(); + } + if (defaultMetadata() != null) { + defaultMetadata().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPath.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPath.java new file mode 100644 index 0000000000000..0eda721693ef3 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPath.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** The type of the paths for alias. */ +@Fluent +public final class AliasPath { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AliasPath.class); + + /* + * The path of an alias. + */ + @JsonProperty(value = "path") + private String path; + + /* + * The API versions. + */ + @JsonProperty(value = "apiVersions") + private List apiVersions; + + /* + * The pattern for an alias path. + */ + @JsonProperty(value = "pattern") + private AliasPattern pattern; + + /* + * The metadata of the alias path. If missing, fall back to the default + * metadata of the alias. + */ + @JsonProperty(value = "metadata", access = JsonProperty.Access.WRITE_ONLY) + private AliasPathMetadata metadata; + + /** + * Get the path property: The path of an alias. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path of an alias. + * + * @param path the path value to set. + * @return the AliasPath object itself. + */ + public AliasPath withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the apiVersions property: The API versions. + * + * @return the apiVersions value. + */ + public List apiVersions() { + return this.apiVersions; + } + + /** + * Set the apiVersions property: The API versions. + * + * @param apiVersions the apiVersions value to set. + * @return the AliasPath object itself. + */ + public AliasPath withApiVersions(List apiVersions) { + this.apiVersions = apiVersions; + return this; + } + + /** + * Get the pattern property: The pattern for an alias path. + * + * @return the pattern value. + */ + public AliasPattern pattern() { + return this.pattern; + } + + /** + * Set the pattern property: The pattern for an alias path. + * + * @param pattern the pattern value to set. + * @return the AliasPath object itself. + */ + public AliasPath withPattern(AliasPattern pattern) { + this.pattern = pattern; + return this; + } + + /** + * Get the metadata property: The metadata of the alias path. If missing, fall back to the default metadata of the + * alias. + * + * @return the metadata value. + */ + public AliasPathMetadata metadata() { + return this.metadata; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (pattern() != null) { + pattern().validate(); + } + if (metadata() != null) { + metadata().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPathAttributes.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPathAttributes.java new file mode 100644 index 0000000000000..6fb3c38ad7273 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPathAttributes.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.resources.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AliasPathAttributes. */ +public final class AliasPathAttributes extends ExpandableStringEnum { + /** Static value None for AliasPathAttributes. */ + public static final AliasPathAttributes NONE = fromString("None"); + + /** Static value Modifiable for AliasPathAttributes. */ + public static final AliasPathAttributes MODIFIABLE = fromString("Modifiable"); + + /** + * Creates or finds a AliasPathAttributes from its string representation. + * + * @param name a name to look for. + * @return the corresponding AliasPathAttributes. + */ + @JsonCreator + public static AliasPathAttributes fromString(String name) { + return fromString(name, AliasPathAttributes.class); + } + + /** @return known AliasPathAttributes values. */ + public static Collection values() { + return values(AliasPathAttributes.class); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPathMetadata.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPathMetadata.java new file mode 100644 index 0000000000000..f21658025666e --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPathMetadata.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AliasPathMetadata model. */ +@Immutable +public final class AliasPathMetadata { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AliasPathMetadata.class); + + /* + * The type of the token that the alias path is referring to. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private AliasPathTokenType type; + + /* + * The attributes of the token that the alias path is referring to. + */ + @JsonProperty(value = "attributes", access = JsonProperty.Access.WRITE_ONLY) + private AliasPathAttributes attributes; + + /** + * Get the type property: The type of the token that the alias path is referring to. + * + * @return the type value. + */ + public AliasPathTokenType type() { + return this.type; + } + + /** + * Get the attributes property: The attributes of the token that the alias path is referring to. + * + * @return the attributes value. + */ + public AliasPathAttributes attributes() { + return this.attributes; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPathTokenType.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPathTokenType.java new file mode 100644 index 0000000000000..45151bb7908f0 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPathTokenType.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.resources.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AliasPathTokenType. */ +public final class AliasPathTokenType extends ExpandableStringEnum { + /** Static value NotSpecified for AliasPathTokenType. */ + public static final AliasPathTokenType NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Any for AliasPathTokenType. */ + public static final AliasPathTokenType ANY = fromString("Any"); + + /** Static value String for AliasPathTokenType. */ + public static final AliasPathTokenType STRING = fromString("String"); + + /** Static value Object for AliasPathTokenType. */ + public static final AliasPathTokenType OBJECT = fromString("Object"); + + /** Static value Array for AliasPathTokenType. */ + public static final AliasPathTokenType ARRAY = fromString("Array"); + + /** Static value Integer for AliasPathTokenType. */ + public static final AliasPathTokenType INTEGER = fromString("Integer"); + + /** Static value Number for AliasPathTokenType. */ + public static final AliasPathTokenType NUMBER = fromString("Number"); + + /** Static value Boolean for AliasPathTokenType. */ + public static final AliasPathTokenType BOOLEAN = fromString("Boolean"); + + /** + * Creates or finds a AliasPathTokenType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AliasPathTokenType. + */ + @JsonCreator + public static AliasPathTokenType fromString(String name) { + return fromString(name, AliasPathTokenType.class); + } + + /** @return known AliasPathTokenType values. */ + public static Collection values() { + return values(AliasPathTokenType.class); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPattern.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPattern.java new file mode 100644 index 0000000000000..2a3d460a5ba36 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPattern.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.resources.generated.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 type of the pattern for an alias path. */ +@Fluent +public final class AliasPattern { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AliasPattern.class); + + /* + * The alias pattern phrase. + */ + @JsonProperty(value = "phrase") + private String phrase; + + /* + * The alias pattern variable. + */ + @JsonProperty(value = "variable") + private String variable; + + /* + * The type of alias pattern + */ + @JsonProperty(value = "type") + private AliasPatternType type; + + /** + * Get the phrase property: The alias pattern phrase. + * + * @return the phrase value. + */ + public String phrase() { + return this.phrase; + } + + /** + * Set the phrase property: The alias pattern phrase. + * + * @param phrase the phrase value to set. + * @return the AliasPattern object itself. + */ + public AliasPattern withPhrase(String phrase) { + this.phrase = phrase; + return this; + } + + /** + * Get the variable property: The alias pattern variable. + * + * @return the variable value. + */ + public String variable() { + return this.variable; + } + + /** + * Set the variable property: The alias pattern variable. + * + * @param variable the variable value to set. + * @return the AliasPattern object itself. + */ + public AliasPattern withVariable(String variable) { + this.variable = variable; + return this; + } + + /** + * Get the type property: The type of alias pattern. + * + * @return the type value. + */ + public AliasPatternType type() { + return this.type; + } + + /** + * Set the type property: The type of alias pattern. + * + * @param type the type value to set. + * @return the AliasPattern object itself. + */ + public AliasPattern withType(AliasPatternType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPatternType.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPatternType.java new file mode 100644 index 0000000000000..80aa9298d72df --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasPatternType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AliasPatternType. */ +public enum AliasPatternType { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value Extract. */ + EXTRACT("Extract"); + + /** The actual serialized value for a AliasPatternType instance. */ + private final String value; + + AliasPatternType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AliasPatternType instance. + * + * @param value the serialized value to parse. + * @return the parsed AliasPatternType object, or null if unable to parse. + */ + @JsonCreator + public static AliasPatternType fromString(String value) { + AliasPatternType[] items = AliasPatternType.values(); + for (AliasPatternType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasType.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasType.java new file mode 100644 index 0000000000000..c7a6269f04b6b --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/AliasType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AliasType. */ +public enum AliasType { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value PlainText. */ + PLAIN_TEXT("PlainText"), + + /** Enum value Mask. */ + MASK("Mask"); + + /** The actual serialized value for a AliasType instance. */ + private final String value; + + AliasType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AliasType instance. + * + * @param value the serialized value to parse. + * @return the parsed AliasType object, or null if unable to parse. + */ + @JsonCreator + public static AliasType fromString(String value) { + AliasType[] items = AliasType.values(); + for (AliasType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ApiProfile.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ApiProfile.java new file mode 100644 index 0000000000000..481009bec7f26 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ApiProfile.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ApiProfile model. */ +@Immutable +public final class ApiProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiProfile.class); + + /* + * The profile version. + */ + @JsonProperty(value = "profileVersion", access = JsonProperty.Access.WRITE_ONLY) + private String profileVersion; + + /* + * The API version. + */ + @JsonProperty(value = "apiVersion", access = JsonProperty.Access.WRITE_ONLY) + private String apiVersion; + + /** + * Get the profileVersion property: The profile version. + * + * @return the profileVersion value. + */ + public String profileVersion() { + return this.profileVersion; + } + + /** + * Get the apiVersion property: The API version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/BasicDependency.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/BasicDependency.java new file mode 100644 index 0000000000000..957dc8e0def64 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/BasicDependency.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.resources.generated.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; + +/** Deployment dependency information. */ +@Fluent +public final class BasicDependency { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BasicDependency.class); + + /* + * The ID of the dependency. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The dependency resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * The dependency resource name. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /** + * Get the id property: The ID of the dependency. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ID of the dependency. + * + * @param id the id value to set. + * @return the BasicDependency object itself. + */ + public BasicDependency withId(String id) { + this.id = id; + return this; + } + + /** + * Get the resourceType property: The dependency resource type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: The dependency resource type. + * + * @param resourceType the resourceType value to set. + * @return the BasicDependency object itself. + */ + public BasicDependency withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the resourceName property: The dependency resource name. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: The dependency resource name. + * + * @param resourceName the resourceName value to set. + * @return the BasicDependency object itself. + */ + public BasicDependency withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ChangeType.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ChangeType.java new file mode 100644 index 0000000000000..bbf579bc69244 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ChangeType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ChangeType. */ +public enum ChangeType { + /** Enum value Create. */ + CREATE("Create"), + + /** Enum value Delete. */ + DELETE("Delete"), + + /** Enum value Ignore. */ + IGNORE("Ignore"), + + /** Enum value Deploy. */ + DEPLOY("Deploy"), + + /** Enum value NoChange. */ + NO_CHANGE("NoChange"), + + /** Enum value Modify. */ + MODIFY("Modify"), + + /** Enum value Unsupported. */ + UNSUPPORTED("Unsupported"); + + /** The actual serialized value for a ChangeType instance. */ + private final String value; + + ChangeType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ChangeType instance. + * + * @param value the serialized value to parse. + * @return the parsed ChangeType object, or null if unable to parse. + */ + @JsonCreator + public static ChangeType fromString(String value) { + ChangeType[] items = ChangeType.values(); + for (ChangeType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DebugSetting.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DebugSetting.java new file mode 100644 index 0000000000000..a4491e222851d --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DebugSetting.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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 debug setting. */ +@Fluent +public final class DebugSetting { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DebugSetting.class); + + /* + * Specifies the type of information to log for debugging. The permitted + * values are none, requestContent, responseContent, or both requestContent + * and responseContent separated by a comma. The default is none. When + * setting this value, carefully consider the type of information you are + * passing in during deployment. By logging information about the request + * or response, you could potentially expose sensitive data that is + * retrieved through the deployment operations. + */ + @JsonProperty(value = "detailLevel") + private String detailLevel; + + /** + * Get the detailLevel property: Specifies the type of information to log for debugging. The permitted values are + * none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The + * default is none. When setting this value, carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could potentially expose sensitive data + * that is retrieved through the deployment operations. + * + * @return the detailLevel value. + */ + public String detailLevel() { + return this.detailLevel; + } + + /** + * Set the detailLevel property: Specifies the type of information to log for debugging. The permitted values are + * none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The + * default is none. When setting this value, carefully consider the type of information you are passing in during + * deployment. By logging information about the request or response, you could potentially expose sensitive data + * that is retrieved through the deployment operations. + * + * @param detailLevel the detailLevel value to set. + * @return the DebugSetting object itself. + */ + public DebugSetting withDetailLevel(String detailLevel) { + this.detailLevel = detailLevel; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Dependency.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Dependency.java new file mode 100644 index 0000000000000..0d80626df09bd --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Dependency.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.resources.generated.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; + +/** Deployment dependency information. */ +@Fluent +public final class Dependency { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Dependency.class); + + /* + * The list of dependencies. + */ + @JsonProperty(value = "dependsOn") + private List dependsOn; + + /* + * The ID of the dependency. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The dependency resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * The dependency resource name. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /** + * Get the dependsOn property: The list of dependencies. + * + * @return the dependsOn value. + */ + public List dependsOn() { + return this.dependsOn; + } + + /** + * Set the dependsOn property: The list of dependencies. + * + * @param dependsOn the dependsOn value to set. + * @return the Dependency object itself. + */ + public Dependency withDependsOn(List dependsOn) { + this.dependsOn = dependsOn; + return this; + } + + /** + * Get the id property: The ID of the dependency. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ID of the dependency. + * + * @param id the id value to set. + * @return the Dependency object itself. + */ + public Dependency withId(String id) { + this.id = id; + return this; + } + + /** + * Get the resourceType property: The dependency resource type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: The dependency resource type. + * + * @param resourceType the resourceType value to set. + * @return the Dependency object itself. + */ + public Dependency withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the resourceName property: The dependency resource name. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: The dependency resource name. + * + * @param resourceName the resourceName value to set. + * @return the Dependency object itself. + */ + public Dependency withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dependsOn() != null) { + dependsOn().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Deployment.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Deployment.java new file mode 100644 index 0000000000000..6490a6ee9b144 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Deployment.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Deployment operation parameters. */ +@Fluent +public final class Deployment { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Deployment.class); + + /* + * The location to store the deployment data. + */ + @JsonProperty(value = "location") + private String location; + + /* + * The deployment properties. + */ + @JsonProperty(value = "properties", required = true) + private DeploymentProperties properties; + + /* + * Deployment tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the location property: The location to store the deployment data. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location to store the deployment data. + * + * @param location the location value to set. + * @return the Deployment object itself. + */ + public Deployment withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the properties property: The deployment properties. + * + * @return the properties value. + */ + public DeploymentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The deployment properties. + * + * @param properties the properties value to set. + * @return the Deployment object itself. + */ + public Deployment withProperties(DeploymentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Deployment tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Deployment tags. + * + * @param tags the tags value to set. + * @return the Deployment object itself. + */ + public Deployment 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) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property properties in model Deployment")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentExportResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentExportResult.java new file mode 100644 index 0000000000000..63d38a22245c8 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentExportResult.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.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExportResultInner; + +/** An immutable client-side representation of DeploymentExportResult. */ +public interface DeploymentExportResult { + /** + * Gets the template property: The template content. + * + * @return the template value. + */ + Object template(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExportResultInner object. + * + * @return the inner object. + */ + DeploymentExportResultInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentExtended.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentExtended.java new file mode 100644 index 0000000000000..a33f4a32f1d63 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentExtended.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExtendedInner; +import java.util.Map; + +/** An immutable client-side representation of DeploymentExtended. */ +public interface DeploymentExtended { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: Deployment properties. + * + * @return the properties value. + */ + DeploymentPropertiesExtended properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExtendedInner object. + * + * @return the inner object. + */ + DeploymentExtendedInner innerModel(); + + /** The entirety of the DeploymentExtended definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The DeploymentExtended definition stages. */ + interface DefinitionStages { + /** The first stage of the DeploymentExtended definition. */ + interface Blank extends WithResourceGroup { + } + /** The stage of the DeploymentExtended definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case + * insensitive. The resource group must already exist. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the DeploymentExtended definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The deployment properties.. + * + * @param properties The deployment properties. + * @return the next definition stage. + */ + WithCreate withProperties(DeploymentProperties properties); + } + /** + * The stage of the DeploymentExtended 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + DeploymentExtended create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DeploymentExtended create(Context context); + } + /** The stage of the DeploymentExtended definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The location to store the deployment data. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The location to store the deployment data. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the DeploymentExtended definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Deployment tags. + * + * @param tags Deployment tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Begins update for the DeploymentExtended resource. + * + * @return the stage of resource update. + */ + DeploymentExtended.Update update(); + + /** The template for DeploymentExtended update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DeploymentExtended apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DeploymentExtended apply(Context context); + } + /** The DeploymentExtended update stages. */ + interface UpdateStages { + /** The stage of the DeploymentExtended update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Deployment tags. + * + * @param tags Deployment tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the DeploymentExtended update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The deployment properties.. + * + * @param properties The deployment properties. + * @return the next definition stage. + */ + Update withProperties(DeploymentProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DeploymentExtended refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DeploymentExtended refresh(Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @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 cancel(); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelWithResponse(Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validate(Deployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validate(Deployment parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + WhatIfOperationResult whatIf(DeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + WhatIfOperationResult whatIf(DeploymentWhatIf parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @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 deployment export result. + */ + DeploymentExportResult exportTemplate(); + + /** + * Exports the template used for specified deployment. + * + * @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 deployment export result along with {@link Response}. + */ + Response exportTemplateWithResponse(Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentListResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentListResult.java new file mode 100644 index 0000000000000..b5e0a215af4c7 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentExtendedInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of deployments. */ +@Fluent +public final class DeploymentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentListResult.class); + + /* + * An array of deployments. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: An array of deployments. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of deployments. + * + * @param value the value value to set. + * @return the DeploymentListResult object itself. + */ + public DeploymentListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentMode.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentMode.java new file mode 100644 index 0000000000000..a849fba1e4ef8 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentMode.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DeploymentMode. */ +public enum DeploymentMode { + /** Enum value Incremental. */ + INCREMENTAL("Incremental"), + + /** Enum value Complete. */ + COMPLETE("Complete"); + + /** The actual serialized value for a DeploymentMode instance. */ + private final String value; + + DeploymentMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DeploymentMode instance. + * + * @param value the serialized value to parse. + * @return the parsed DeploymentMode object, or null if unable to parse. + */ + @JsonCreator + public static DeploymentMode fromString(String value) { + DeploymentMode[] items = DeploymentMode.values(); + for (DeploymentMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperation.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperation.java new file mode 100644 index 0000000000000..bb81ec8a6f7ec --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperation.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.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentOperationInner; + +/** An immutable client-side representation of DeploymentOperation. */ +public interface DeploymentOperation { + /** + * Gets the id property: Full deployment operation ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the operationId property: Deployment operation ID. + * + * @return the operationId value. + */ + String operationId(); + + /** + * Gets the properties property: Deployment properties. + * + * @return the properties value. + */ + DeploymentOperationProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.DeploymentOperationInner object. + * + * @return the inner object. + */ + DeploymentOperationInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperationProperties.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperationProperties.java new file mode 100644 index 0000000000000..dfdb80f9a4d92 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperationProperties.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Deployment operation properties. */ +@Immutable +public final class DeploymentOperationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentOperationProperties.class); + + /* + * The name of the current provisioning operation. + */ + @JsonProperty(value = "provisioningOperation", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningOperation provisioningOperation; + + /* + * The state of the provisioning. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The date and time of the operation. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timestamp; + + /* + * The duration of the operation. + */ + @JsonProperty(value = "duration", access = JsonProperty.Access.WRITE_ONLY) + private String duration; + + /* + * Deployment operation service request id. + */ + @JsonProperty(value = "serviceRequestId", access = JsonProperty.Access.WRITE_ONLY) + private String serviceRequestId; + + /* + * Operation status code from the resource provider. This property may not + * be set if a response has not yet been received. + */ + @JsonProperty(value = "statusCode", access = JsonProperty.Access.WRITE_ONLY) + private String statusCode; + + /* + * Operation status message from the resource provider. This property is + * optional. It will only be provided if an error was received from the + * resource provider. + */ + @JsonProperty(value = "statusMessage", access = JsonProperty.Access.WRITE_ONLY) + private StatusMessage statusMessage; + + /* + * The target resource. + */ + @JsonProperty(value = "targetResource", access = JsonProperty.Access.WRITE_ONLY) + private TargetResource targetResource; + + /* + * The HTTP request message. + */ + @JsonProperty(value = "request", access = JsonProperty.Access.WRITE_ONLY) + private HttpMessage request; + + /* + * The HTTP response message. + */ + @JsonProperty(value = "response", access = JsonProperty.Access.WRITE_ONLY) + private HttpMessage response; + + /** + * Get the provisioningOperation property: The name of the current provisioning operation. + * + * @return the provisioningOperation value. + */ + public ProvisioningOperation provisioningOperation() { + return this.provisioningOperation; + } + + /** + * Get the provisioningState property: The state of the provisioning. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the timestamp property: The date and time of the operation. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the duration property: The duration of the operation. + * + * @return the duration value. + */ + public String duration() { + return this.duration; + } + + /** + * Get the serviceRequestId property: Deployment operation service request id. + * + * @return the serviceRequestId value. + */ + public String serviceRequestId() { + return this.serviceRequestId; + } + + /** + * Get the statusCode property: Operation status code from the resource provider. This property may not be set if a + * response has not yet been received. + * + * @return the statusCode value. + */ + public String statusCode() { + return this.statusCode; + } + + /** + * Get the statusMessage property: Operation status message from the resource provider. This property is optional. + * It will only be provided if an error was received from the resource provider. + * + * @return the statusMessage value. + */ + public StatusMessage statusMessage() { + return this.statusMessage; + } + + /** + * Get the targetResource property: The target resource. + * + * @return the targetResource value. + */ + public TargetResource targetResource() { + return this.targetResource; + } + + /** + * Get the request property: The HTTP request message. + * + * @return the request value. + */ + public HttpMessage request() { + return this.request; + } + + /** + * Get the response property: The HTTP response message. + * + * @return the response value. + */ + public HttpMessage response() { + return this.response; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (statusMessage() != null) { + statusMessage().validate(); + } + if (targetResource() != null) { + targetResource().validate(); + } + if (request() != null) { + request().validate(); + } + if (response() != null) { + response().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperations.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperations.java new file mode 100644 index 0000000000000..bad512067bf1d --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperations.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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 DeploymentOperations. */ +public interface DeploymentOperations { + /** + * Gets a deployments operation. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + DeploymentOperation getAtScope(String scope, String deploymentName, String operationId); + + /** + * Gets a deployments operation. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + Response getAtScopeWithResponse( + String scope, String deploymentName, String operationId, Context context); + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtScope(String scope, String deploymentName); + + /** + * Gets all deployments operations for a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtScope(String scope, String deploymentName, Integer top, Context context); + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + DeploymentOperation getAtTenantScope(String deploymentName, String operationId); + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + Response getAtTenantScopeWithResponse( + String deploymentName, String operationId, Context context); + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtTenantScope(String deploymentName); + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtTenantScope(String deploymentName, Integer top, Context context); + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + DeploymentOperation getAtManagementGroupScope(String groupId, String deploymentName, String operationId); + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + Response getAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, String operationId, Context context); + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtManagementGroupScope(String groupId, String deploymentName); + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtManagementGroupScope( + String groupId, String deploymentName, Integer top, Context context); + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + DeploymentOperation getAtSubscriptionScope(String deploymentName, String operationId); + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + Response getAtSubscriptionScopeWithResponse( + String deploymentName, String operationId, Context context); + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtSubscriptionScope(String deploymentName); + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtSubscriptionScope(String deploymentName, Integer top, Context context); + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation. + */ + DeploymentOperation get(String resourceGroupName, String deploymentName, String operationId); + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployments operation along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String deploymentName, String operationId, Context context); + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String deploymentName); + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @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 deployments operations for a deployment as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, String deploymentName, Integer top, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperationsListResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperationsListResult.java new file mode 100644 index 0000000000000..fb8df8f571d41 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentOperationsListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of deployment operations. */ +@Fluent +public final class DeploymentOperationsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentOperationsListResult.class); + + /* + * An array of deployment operations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: An array of deployment operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of deployment operations. + * + * @param value the value value to set. + * @return the DeploymentOperationsListResult object itself. + */ + public DeploymentOperationsListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentProperties.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentProperties.java new file mode 100644 index 0000000000000..6512e841821dc --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentProperties.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Deployment properties. */ +@Fluent +public class DeploymentProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentProperties.class); + + /* + * The template content. You use this element when you want to pass the + * template syntax directly in the request rather than link to an existing + * template. It can be a JObject or well-formed JSON string. Use either the + * templateLink property or the template property, but not both. + */ + @JsonProperty(value = "template") + private Object template; + + /* + * The URI of the template. Use either the templateLink property or the + * template property, but not both. + */ + @JsonProperty(value = "templateLink") + private TemplateLink templateLink; + + /* + * Name and value pairs that define the deployment parameters for the + * template. You use this element when you want to provide the parameter + * values directly in the request rather than link to an existing parameter + * file. Use either the parametersLink property or the parameters property, + * but not both. It can be a JObject or a well formed JSON string. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /* + * The URI of parameters file. You use this element to link to an existing + * parameters file. Use either the parametersLink property or the + * parameters property, but not both. + */ + @JsonProperty(value = "parametersLink") + private ParametersLink parametersLink; + + /* + * The mode that is used to deploy resources. This value can be either + * Incremental or Complete. In Incremental mode, resources are deployed + * without deleting existing resources that are not included in the + * template. In Complete mode, resources are deployed and existing + * resources in the resource group that are not included in the template + * are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. + */ + @JsonProperty(value = "mode", required = true) + private DeploymentMode mode; + + /* + * The debug setting of the deployment. + */ + @JsonProperty(value = "debugSetting") + private DebugSetting debugSetting; + + /* + * The deployment on error behavior. + */ + @JsonProperty(value = "onErrorDeployment") + private OnErrorDeployment onErrorDeployment; + + /* + * Specifies whether template expressions are evaluated within the scope of + * the parent template or nested template. Only applicable to nested + * templates. If not specified, default value is outer. + */ + @JsonProperty(value = "expressionEvaluationOptions") + private ExpressionEvaluationOptions expressionEvaluationOptions; + + /** + * Get the template property: The template content. You use this element when you want to pass the template syntax + * directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. + * Use either the templateLink property or the template property, but not both. + * + * @return the template value. + */ + public Object template() { + return this.template; + } + + /** + * Set the template property: The template content. You use this element when you want to pass the template syntax + * directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. + * Use either the templateLink property or the template property, but not both. + * + * @param template the template value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withTemplate(Object template) { + this.template = template; + return this; + } + + /** + * Get the templateLink property: The URI of the template. Use either the templateLink property or the template + * property, but not both. + * + * @return the templateLink value. + */ + public TemplateLink templateLink() { + return this.templateLink; + } + + /** + * Set the templateLink property: The URI of the template. Use either the templateLink property or the template + * property, but not both. + * + * @param templateLink the templateLink value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withTemplateLink(TemplateLink templateLink) { + this.templateLink = templateLink; + return this; + } + + /** + * Get the parameters property: Name and value pairs that define the deployment parameters for the template. You use + * this element when you want to provide the parameter values directly in the request rather than link to an + * existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can + * be a JObject or a well formed JSON string. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the parameters property: Name and value pairs that define the deployment parameters for the template. You use + * this element when you want to provide the parameter values directly in the request rather than link to an + * existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can + * be a JObject or a well formed JSON string. + * + * @param parameters the parameters value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the parametersLink property: The URI of parameters file. You use this element to link to an existing + * parameters file. Use either the parametersLink property or the parameters property, but not both. + * + * @return the parametersLink value. + */ + public ParametersLink parametersLink() { + return this.parametersLink; + } + + /** + * Set the parametersLink property: The URI of parameters file. You use this element to link to an existing + * parameters file. Use either the parametersLink property or the parameters property, but not both. + * + * @param parametersLink the parametersLink value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withParametersLink(ParametersLink parametersLink) { + this.parametersLink = parametersLink; + return this; + } + + /** + * Get the mode property: The mode that is used to deploy resources. This value can be either Incremental or + * Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included + * in the template. In Complete mode, resources are deployed and existing resources in the resource group that are + * not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete + * resources. + * + * @return the mode value. + */ + public DeploymentMode mode() { + return this.mode; + } + + /** + * Set the mode property: The mode that is used to deploy resources. This value can be either Incremental or + * Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included + * in the template. In Complete mode, resources are deployed and existing resources in the resource group that are + * not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete + * resources. + * + * @param mode the mode value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withMode(DeploymentMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the debugSetting property: The debug setting of the deployment. + * + * @return the debugSetting value. + */ + public DebugSetting debugSetting() { + return this.debugSetting; + } + + /** + * Set the debugSetting property: The debug setting of the deployment. + * + * @param debugSetting the debugSetting value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withDebugSetting(DebugSetting debugSetting) { + this.debugSetting = debugSetting; + return this; + } + + /** + * Get the onErrorDeployment property: The deployment on error behavior. + * + * @return the onErrorDeployment value. + */ + public OnErrorDeployment onErrorDeployment() { + return this.onErrorDeployment; + } + + /** + * Set the onErrorDeployment property: The deployment on error behavior. + * + * @param onErrorDeployment the onErrorDeployment value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withOnErrorDeployment(OnErrorDeployment onErrorDeployment) { + this.onErrorDeployment = onErrorDeployment; + return this; + } + + /** + * Get the expressionEvaluationOptions property: Specifies whether template expressions are evaluated within the + * scope of the parent template or nested template. Only applicable to nested templates. If not specified, default + * value is outer. + * + * @return the expressionEvaluationOptions value. + */ + public ExpressionEvaluationOptions expressionEvaluationOptions() { + return this.expressionEvaluationOptions; + } + + /** + * Set the expressionEvaluationOptions property: Specifies whether template expressions are evaluated within the + * scope of the parent template or nested template. Only applicable to nested templates. If not specified, default + * value is outer. + * + * @param expressionEvaluationOptions the expressionEvaluationOptions value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withExpressionEvaluationOptions( + ExpressionEvaluationOptions expressionEvaluationOptions) { + this.expressionEvaluationOptions = expressionEvaluationOptions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (templateLink() != null) { + templateLink().validate(); + } + if (parametersLink() != null) { + parametersLink().validate(); + } + if (mode() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property mode in model DeploymentProperties")); + } + if (debugSetting() != null) { + debugSetting().validate(); + } + if (onErrorDeployment() != null) { + onErrorDeployment().validate(); + } + if (expressionEvaluationOptions() != null) { + expressionEvaluationOptions().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentPropertiesExtended.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentPropertiesExtended.java new file mode 100644 index 0000000000000..c54e8b578d877 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentPropertiesExtended.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Deployment properties with additional details. */ +@Immutable +public final class DeploymentPropertiesExtended { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentPropertiesExtended.class); + + /* + * Denotes the state of provisioning. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The correlation ID of the deployment. + */ + @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /* + * The timestamp of the template deployment. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timestamp; + + /* + * The duration of the template deployment. + */ + @JsonProperty(value = "duration", access = JsonProperty.Access.WRITE_ONLY) + private String duration; + + /* + * Key/value pairs that represent deployment output. + */ + @JsonProperty(value = "outputs", access = JsonProperty.Access.WRITE_ONLY) + private Object outputs; + + /* + * The list of resource providers needed for the deployment. + */ + @JsonProperty(value = "providers", access = JsonProperty.Access.WRITE_ONLY) + private List providers; + + /* + * The list of deployment dependencies. + */ + @JsonProperty(value = "dependencies", access = JsonProperty.Access.WRITE_ONLY) + private List dependencies; + + /* + * The URI referencing the template. + */ + @JsonProperty(value = "templateLink", access = JsonProperty.Access.WRITE_ONLY) + private TemplateLink templateLink; + + /* + * Deployment parameters. + */ + @JsonProperty(value = "parameters", access = JsonProperty.Access.WRITE_ONLY) + private Object parameters; + + /* + * The URI referencing the parameters. + */ + @JsonProperty(value = "parametersLink", access = JsonProperty.Access.WRITE_ONLY) + private ParametersLink parametersLink; + + /* + * The deployment mode. Possible values are Incremental and Complete. + */ + @JsonProperty(value = "mode", access = JsonProperty.Access.WRITE_ONLY) + private DeploymentMode mode; + + /* + * The debug setting of the deployment. + */ + @JsonProperty(value = "debugSetting", access = JsonProperty.Access.WRITE_ONLY) + private DebugSetting debugSetting; + + /* + * The deployment on error behavior. + */ + @JsonProperty(value = "onErrorDeployment", access = JsonProperty.Access.WRITE_ONLY) + private OnErrorDeploymentExtended onErrorDeployment; + + /* + * The hash produced for the template. + */ + @JsonProperty(value = "templateHash", access = JsonProperty.Access.WRITE_ONLY) + private String templateHash; + + /* + * Array of provisioned resources. + */ + @JsonProperty(value = "outputResources", access = JsonProperty.Access.WRITE_ONLY) + private List outputResources; + + /* + * Array of validated resources. + */ + @JsonProperty(value = "validatedResources", access = JsonProperty.Access.WRITE_ONLY) + private List validatedResources; + + /* + * Error Response The deployment error. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ManagementError error; + + /** + * Get the provisioningState property: Denotes the state of provisioning. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the correlationId property: The correlation ID of the deployment. + * + * @return the correlationId value. + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Get the timestamp property: The timestamp of the template deployment. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the duration property: The duration of the template deployment. + * + * @return the duration value. + */ + public String duration() { + return this.duration; + } + + /** + * Get the outputs property: Key/value pairs that represent deployment output. + * + * @return the outputs value. + */ + public Object outputs() { + return this.outputs; + } + + /** + * Get the providers property: The list of resource providers needed for the deployment. + * + * @return the providers value. + */ + public List providers() { + return this.providers; + } + + /** + * Get the dependencies property: The list of deployment dependencies. + * + * @return the dependencies value. + */ + public List dependencies() { + return this.dependencies; + } + + /** + * Get the templateLink property: The URI referencing the template. + * + * @return the templateLink value. + */ + public TemplateLink templateLink() { + return this.templateLink; + } + + /** + * Get the parameters property: Deployment parameters. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Get the parametersLink property: The URI referencing the parameters. + * + * @return the parametersLink value. + */ + public ParametersLink parametersLink() { + return this.parametersLink; + } + + /** + * Get the mode property: The deployment mode. Possible values are Incremental and Complete. + * + * @return the mode value. + */ + public DeploymentMode mode() { + return this.mode; + } + + /** + * Get the debugSetting property: The debug setting of the deployment. + * + * @return the debugSetting value. + */ + public DebugSetting debugSetting() { + return this.debugSetting; + } + + /** + * Get the onErrorDeployment property: The deployment on error behavior. + * + * @return the onErrorDeployment value. + */ + public OnErrorDeploymentExtended onErrorDeployment() { + return this.onErrorDeployment; + } + + /** + * Get the templateHash property: The hash produced for the template. + * + * @return the templateHash value. + */ + public String templateHash() { + return this.templateHash; + } + + /** + * Get the outputResources property: Array of provisioned resources. + * + * @return the outputResources value. + */ + public List outputResources() { + return this.outputResources; + } + + /** + * Get the validatedResources property: Array of validated resources. + * + * @return the validatedResources value. + */ + public List validatedResources() { + return this.validatedResources; + } + + /** + * Get the error property: Error Response The deployment error. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (providers() != null) { + providers().forEach(e -> e.validate()); + } + if (dependencies() != null) { + dependencies().forEach(e -> e.validate()); + } + if (templateLink() != null) { + templateLink().validate(); + } + if (parametersLink() != null) { + parametersLink().validate(); + } + if (debugSetting() != null) { + debugSetting().validate(); + } + if (onErrorDeployment() != null) { + onErrorDeployment().validate(); + } + if (outputResources() != null) { + outputResources().forEach(e -> e.validate()); + } + if (validatedResources() != null) { + validatedResources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentValidateResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentValidateResult.java new file mode 100644 index 0000000000000..23519c6e2d320 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentValidateResult.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.resources.generated.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.resources.generated.fluent.models.DeploymentValidateResultInner; + +/** An immutable client-side representation of DeploymentValidateResult. */ +public interface DeploymentValidateResult { + /** + * Gets the error property: Error Response The deployment validation error. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the properties property: The template deployment properties. + * + * @return the properties value. + */ + DeploymentPropertiesExtended properties(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.DeploymentValidateResultInner object. + * + * @return the inner object. + */ + DeploymentValidateResultInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentWhatIf.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentWhatIf.java new file mode 100644 index 0000000000000..fc5ed24bb359d --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentWhatIf.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Deployment What-if operation parameters. */ +@Fluent +public final class DeploymentWhatIf { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentWhatIf.class); + + /* + * The location to store the deployment data. + */ + @JsonProperty(value = "location") + private String location; + + /* + * The deployment properties. + */ + @JsonProperty(value = "properties", required = true) + private DeploymentWhatIfProperties properties; + + /** + * Get the location property: The location to store the deployment data. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location to store the deployment data. + * + * @param location the location value to set. + * @return the DeploymentWhatIf object itself. + */ + public DeploymentWhatIf withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the properties property: The deployment properties. + * + * @return the properties value. + */ + public DeploymentWhatIfProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The deployment properties. + * + * @param properties the properties value to set. + * @return the DeploymentWhatIf object itself. + */ + public DeploymentWhatIf withProperties(DeploymentWhatIfProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property properties in model DeploymentWhatIf")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentWhatIfProperties.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentWhatIfProperties.java new file mode 100644 index 0000000000000..7abcdff2f98ee --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentWhatIfProperties.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Deployment What-if properties. */ +@Fluent +public final class DeploymentWhatIfProperties extends DeploymentProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentWhatIfProperties.class); + + /* + * Optional What-If operation settings. + */ + @JsonProperty(value = "whatIfSettings") + private DeploymentWhatIfSettings whatIfSettings; + + /** + * Get the whatIfSettings property: Optional What-If operation settings. + * + * @return the whatIfSettings value. + */ + public DeploymentWhatIfSettings whatIfSettings() { + return this.whatIfSettings; + } + + /** + * Set the whatIfSettings property: Optional What-If operation settings. + * + * @param whatIfSettings the whatIfSettings value to set. + * @return the DeploymentWhatIfProperties object itself. + */ + public DeploymentWhatIfProperties withWhatIfSettings(DeploymentWhatIfSettings whatIfSettings) { + this.whatIfSettings = whatIfSettings; + return this; + } + + /** {@inheritDoc} */ + @Override + public DeploymentWhatIfProperties withTemplate(Object template) { + super.withTemplate(template); + return this; + } + + /** {@inheritDoc} */ + @Override + public DeploymentWhatIfProperties withTemplateLink(TemplateLink templateLink) { + super.withTemplateLink(templateLink); + return this; + } + + /** {@inheritDoc} */ + @Override + public DeploymentWhatIfProperties withParameters(Object parameters) { + super.withParameters(parameters); + return this; + } + + /** {@inheritDoc} */ + @Override + public DeploymentWhatIfProperties withParametersLink(ParametersLink parametersLink) { + super.withParametersLink(parametersLink); + return this; + } + + /** {@inheritDoc} */ + @Override + public DeploymentWhatIfProperties withMode(DeploymentMode mode) { + super.withMode(mode); + return this; + } + + /** {@inheritDoc} */ + @Override + public DeploymentWhatIfProperties withDebugSetting(DebugSetting debugSetting) { + super.withDebugSetting(debugSetting); + return this; + } + + /** {@inheritDoc} */ + @Override + public DeploymentWhatIfProperties withOnErrorDeployment(OnErrorDeployment onErrorDeployment) { + super.withOnErrorDeployment(onErrorDeployment); + return this; + } + + /** {@inheritDoc} */ + @Override + public DeploymentWhatIfProperties withExpressionEvaluationOptions( + ExpressionEvaluationOptions expressionEvaluationOptions) { + super.withExpressionEvaluationOptions(expressionEvaluationOptions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (whatIfSettings() != null) { + whatIfSettings().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentWhatIfSettings.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentWhatIfSettings.java new file mode 100644 index 0000000000000..2b44c3fe49c6f --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentWhatIfSettings.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Deployment What-If operation settings. */ +@Fluent +public final class DeploymentWhatIfSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentWhatIfSettings.class); + + /* + * The format of the What-If results + */ + @JsonProperty(value = "resultFormat") + private WhatIfResultFormat resultFormat; + + /** + * Get the resultFormat property: The format of the What-If results. + * + * @return the resultFormat value. + */ + public WhatIfResultFormat resultFormat() { + return this.resultFormat; + } + + /** + * Set the resultFormat property: The format of the What-If results. + * + * @param resultFormat the resultFormat value to set. + * @return the DeploymentWhatIfSettings object itself. + */ + public DeploymentWhatIfSettings withResultFormat(WhatIfResultFormat resultFormat) { + this.resultFormat = resultFormat; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Deployments.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Deployments.java new file mode 100644 index 0000000000000..e147e42370313 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Deployments.java @@ -0,0 +1,1265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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 Deployments. */ +public interface Deployments { + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deleteAtScope(String scope, String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deleteAtScope(String scope, String deploymentName, Context context); + + /** + * Checks whether the deployment exists. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 whether resource exists. + */ + boolean checkExistenceAtScope(String scope, String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + Response checkExistenceAtScopeWithResponse(String scope, String deploymentName, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + DeploymentExtended createOrUpdateAtScope(String scope, String deploymentName, Deployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + DeploymentExtended createOrUpdateAtScope( + String scope, String deploymentName, Deployment parameters, Context context); + + /** + * Gets a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + DeploymentExtended getAtScope(String scope, String deploymentName); + + /** + * Gets a deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + Response getAtScopeWithResponse(String scope, String deploymentName, Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 cancelAtScope(String scope, String deploymentName); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelAtScopeWithResponse(String scope, String deploymentName, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validateAtScope(String scope, String deploymentName, Deployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validateAtScope( + String scope, String deploymentName, Deployment parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deployment export result. + */ + DeploymentExportResult exportTemplateAtScope(String scope, String deploymentName); + + /** + * Exports the template used for specified deployment. + * + * @param scope The resource scope. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + Response exportTemplateAtScopeWithResponse( + String scope, String deploymentName, Context context); + + /** + * Get all the deployments at the given scope. + * + * @param scope The resource scope. + * @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 the deployments at the given scope as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtScope(String scope); + + /** + * Get all the deployments at the given scope. + * + * @param scope The resource scope. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments at the given scope as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtScope(String scope, String filter, Integer top, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtTenantScope(String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtTenantScope(String deploymentName, Context context); + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists. + */ + boolean checkExistenceAtTenantScope(String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + Response checkExistenceAtTenantScopeWithResponse(String deploymentName, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + DeploymentExtended createOrUpdateAtTenantScope(String deploymentName, ScopedDeployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + DeploymentExtended createOrUpdateAtTenantScope(String deploymentName, ScopedDeployment parameters, Context context); + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + DeploymentExtended getAtTenantScope(String deploymentName); + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + Response getAtTenantScopeWithResponse(String deploymentName, Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @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 cancelAtTenantScope(String deploymentName); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelAtTenantScopeWithResponse(String deploymentName, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validateAtTenantScope(String deploymentName, ScopedDeployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validateAtTenantScope(String deploymentName, ScopedDeployment parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + WhatIfOperationResult whatIfAtTenantScope(String deploymentName, ScopedDeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the tenant group. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + WhatIfOperationResult whatIfAtTenantScope( + String deploymentName, ScopedDeploymentWhatIf parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result. + */ + DeploymentExportResult exportTemplateAtTenantScope(String deploymentName); + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + Response exportTemplateAtTenantScopeWithResponse(String deploymentName, Context context); + + /** + * Get all the deployments at the tenant scope. + * + * @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 the deployments at the tenant scope as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtTenantScope(); + + /** + * Get all the deployments at the tenant scope. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments at the tenant scope as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtTenantScope(String filter, Integer top, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deleteAtManagementGroupScope(String groupId, String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deleteAtManagementGroupScope(String groupId, String deploymentName, Context context); + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 whether resource exists. + */ + boolean checkExistenceAtManagementGroupScope(String groupId, String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + Response checkExistenceAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + DeploymentExtended createOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + DeploymentExtended createOrUpdateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context); + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + DeploymentExtended getAtManagementGroupScope(String groupId, String deploymentName); + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + Response getAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 cancelAtManagementGroupScope(String groupId, String deploymentName); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelAtManagementGroupScopeWithResponse(String groupId, String deploymentName, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validateAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeployment parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + WhatIfOperationResult whatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the management group. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + WhatIfOperationResult whatIfAtManagementGroupScope( + String groupId, String deploymentName, ScopedDeploymentWhatIf parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deployment export result. + */ + DeploymentExportResult exportTemplateAtManagementGroupScope(String groupId, String deploymentName); + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + Response exportTemplateAtManagementGroupScopeWithResponse( + String groupId, String deploymentName, Context context); + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group 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 all the deployments for a management group as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtManagementGroupScope(String groupId); + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a management group as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtManagementGroupScope( + String groupId, String filter, Integer top, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtSubscriptionScope(String deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. This is an asynchronous operation that returns a status of 202 until the + * template deployment is successfully deleted. The Location response header contains the URI that is used to obtain + * the status of the process. While the process is running, a call to the URI in the Location header returns a + * status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If + * the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtSubscriptionScope(String deploymentName, Context context); + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists. + */ + boolean checkExistenceAtSubscriptionScope(String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + Response checkExistenceAtSubscriptionScopeWithResponse(String deploymentName, Context context); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + DeploymentExtended createOrUpdateAtSubscriptionScope(String deploymentName, Deployment parameters); + + /** + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deployment information. + */ + DeploymentExtended createOrUpdateAtSubscriptionScope(String deploymentName, Deployment parameters, Context context); + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + DeploymentExtended getAtSubscriptionScope(String deploymentName); + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + Response getAtSubscriptionScopeWithResponse(String deploymentName, Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @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 cancelAtSubscriptionScope(String deploymentName); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelAtSubscriptionScopeWithResponse(String deploymentName, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validateAtSubscriptionScope(String deploymentName, Deployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validateAtSubscriptionScope(String deploymentName, Deployment parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 result of the What-If operation. + */ + WhatIfOperationResult whatIfAtSubscriptionScope(String deploymentName, DeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the subscription. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to What If. + * @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 result of the What-If operation. + */ + WhatIfOperationResult whatIfAtSubscriptionScope( + String deploymentName, DeploymentWhatIf parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result. + */ + DeploymentExportResult exportTemplateAtSubscriptionScope(String deploymentName); + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + Response exportTemplateAtSubscriptionScopeWithResponse( + String deploymentName, Context context); + + /** + * Get all the deployments for a 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 all the deployments for a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String filter, Integer top, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 deploymentName); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 deploymentName, Context context); + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 whether resource exists. + */ + boolean checkExistence(String resourceGroupName, String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @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 whether resource exists along with {@link Response}. + */ + Response checkExistenceWithResponse(String resourceGroupName, String deploymentName, Context context); + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment. + */ + DeploymentExtended getByResourceGroup(String resourceGroupName, String deploymentName); + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String deploymentName, Context context); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 cancel(String resourceGroupName, String deploymentName); + + /** + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is + * canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running + * template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelWithResponse(String resourceGroupName, String deploymentName, Context context); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validate(String resourceGroupName, String deploymentName, Deployment parameters); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource + * Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 from validate template deployment response. + */ + DeploymentValidateResult validate( + String resourceGroupName, String deploymentName, Deployment parameters, Context context); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + WhatIfOperationResult whatIf(String resourceGroupName, String deploymentName, DeploymentWhatIf parameters); + + /** + * Returns changes that will be made by the deployment if executed at the scope of the resource group. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case + * insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 result of the What-If operation. + */ + WhatIfOperationResult whatIf( + String resourceGroupName, String deploymentName, DeploymentWhatIf parameters, Context context); + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deployment export result. + */ + DeploymentExportResult exportTemplate(String resourceGroupName, String deploymentName); + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deployment export result along with {@link Response}. + */ + Response exportTemplateWithResponse( + String resourceGroupName, String deploymentName, Context context); + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the deployments for a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case + * insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 the deployments for a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Integer top, Context context); + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @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 result of the request to calculate template hash. + */ + TemplateHashResult calculateTemplateHash(Object template); + + /** + * Calculate the hash of the given template. + * + * @param template The template provided to calculate hash. + * @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 result of the request to calculate template hash along with {@link Response}. + */ + Response calculateTemplateHashWithResponse(Object template, Context context); + + /** + * Gets a deployment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + DeploymentExtended getById(String id); + + /** + * Gets a deployment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deployment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @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); + + /** + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the + * associated deployment operations. Deleting a template deployment does not affect the state of the resource group. + * This is an asynchronous operation that returns a status of 202 until the template deployment is successfully + * deleted. The Location response header contains the URI that is used to obtain the status of the process. While + * the process is running, a call to the URI in the Location header returns a status of 202. When the process + * finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, + * the URI in the Location header returns an error-level status code. + * + * @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 DeploymentExtended resource. + * + * @param name resource name. + * @return the first stage of the new DeploymentExtended definition. + */ + DeploymentExtended.DefinitionStages.Blank define(String name); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtManagementGroupScopeHeaders.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtManagementGroupScopeHeaders.java new file mode 100644 index 0000000000000..3d6a0544ea759 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtManagementGroupScopeHeaders.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.resources.generated.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 DeploymentsWhatIfAtManagementGroupScopeHeaders model. */ +@Fluent +public final class DeploymentsWhatIfAtManagementGroupScopeHeaders { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(DeploymentsWhatIfAtManagementGroupScopeHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the DeploymentsWhatIfAtManagementGroupScopeHeaders object itself. + */ + public DeploymentsWhatIfAtManagementGroupScopeHeaders withRetryAfter(String 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 DeploymentsWhatIfAtManagementGroupScopeHeaders object itself. + */ + public DeploymentsWhatIfAtManagementGroupScopeHeaders 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtManagementGroupScopeResponse.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtManagementGroupScopeResponse.java new file mode 100644 index 0000000000000..1f0fe7ee00de1 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtManagementGroupScopeResponse.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.resources.generated.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.resources.generated.fluent.models.WhatIfOperationResultInner; + +/** Contains all response data for the whatIfAtManagementGroupScope operation. */ +public final class DeploymentsWhatIfAtManagementGroupScopeResponse + extends ResponseBase { + /** + * Creates an instance of DeploymentsWhatIfAtManagementGroupScopeResponse. + * + * @param request the request which resulted in this DeploymentsWhatIfAtManagementGroupScopeResponse. + * @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 DeploymentsWhatIfAtManagementGroupScopeResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + WhatIfOperationResultInner value, + DeploymentsWhatIfAtManagementGroupScopeHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public WhatIfOperationResultInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtSubscriptionScopeHeaders.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtSubscriptionScopeHeaders.java new file mode 100644 index 0000000000000..29c94cf758e15 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtSubscriptionScopeHeaders.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.resources.generated.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 DeploymentsWhatIfAtSubscriptionScopeHeaders model. */ +@Fluent +public final class DeploymentsWhatIfAtSubscriptionScopeHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentsWhatIfAtSubscriptionScopeHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the DeploymentsWhatIfAtSubscriptionScopeHeaders object itself. + */ + public DeploymentsWhatIfAtSubscriptionScopeHeaders withRetryAfter(String 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 DeploymentsWhatIfAtSubscriptionScopeHeaders object itself. + */ + public DeploymentsWhatIfAtSubscriptionScopeHeaders 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtSubscriptionScopeResponse.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtSubscriptionScopeResponse.java new file mode 100644 index 0000000000000..54bd1fd84fc0b --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtSubscriptionScopeResponse.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.resources.generated.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.resources.generated.fluent.models.WhatIfOperationResultInner; + +/** Contains all response data for the whatIfAtSubscriptionScope operation. */ +public final class DeploymentsWhatIfAtSubscriptionScopeResponse + extends ResponseBase { + /** + * Creates an instance of DeploymentsWhatIfAtSubscriptionScopeResponse. + * + * @param request the request which resulted in this DeploymentsWhatIfAtSubscriptionScopeResponse. + * @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 DeploymentsWhatIfAtSubscriptionScopeResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + WhatIfOperationResultInner value, + DeploymentsWhatIfAtSubscriptionScopeHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public WhatIfOperationResultInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtTenantScopeHeaders.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtTenantScopeHeaders.java new file mode 100644 index 0000000000000..86709313024c2 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtTenantScopeHeaders.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.resources.generated.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 DeploymentsWhatIfAtTenantScopeHeaders model. */ +@Fluent +public final class DeploymentsWhatIfAtTenantScopeHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentsWhatIfAtTenantScopeHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the DeploymentsWhatIfAtTenantScopeHeaders object itself. + */ + public DeploymentsWhatIfAtTenantScopeHeaders withRetryAfter(String 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 DeploymentsWhatIfAtTenantScopeHeaders object itself. + */ + public DeploymentsWhatIfAtTenantScopeHeaders 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtTenantScopeResponse.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtTenantScopeResponse.java new file mode 100644 index 0000000000000..de6b92d42285c --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfAtTenantScopeResponse.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.resources.generated.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.resources.generated.fluent.models.WhatIfOperationResultInner; + +/** Contains all response data for the whatIfAtTenantScope operation. */ +public final class DeploymentsWhatIfAtTenantScopeResponse + extends ResponseBase { + /** + * Creates an instance of DeploymentsWhatIfAtTenantScopeResponse. + * + * @param request the request which resulted in this DeploymentsWhatIfAtTenantScopeResponse. + * @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 DeploymentsWhatIfAtTenantScopeResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + WhatIfOperationResultInner value, + DeploymentsWhatIfAtTenantScopeHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public WhatIfOperationResultInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfHeaders.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfHeaders.java new file mode 100644 index 0000000000000..8f1ae6c4fd871 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfHeaders.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.resources.generated.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 DeploymentsWhatIfHeaders model. */ +@Fluent +public final class DeploymentsWhatIfHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentsWhatIfHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the DeploymentsWhatIfHeaders object itself. + */ + public DeploymentsWhatIfHeaders withRetryAfter(String 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 DeploymentsWhatIfHeaders object itself. + */ + public DeploymentsWhatIfHeaders 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfResponse.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfResponse.java new file mode 100644 index 0000000000000..d6563a4c1451f --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/DeploymentsWhatIfResponse.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.resources.generated.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.resources.generated.fluent.models.WhatIfOperationResultInner; + +/** Contains all response data for the whatIf operation. */ +public final class DeploymentsWhatIfResponse + extends ResponseBase { + /** + * Creates an instance of DeploymentsWhatIfResponse. + * + * @param request the request which resulted in this DeploymentsWhatIfResponse. + * @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 DeploymentsWhatIfResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + WhatIfOperationResultInner value, + DeploymentsWhatIfHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public WhatIfOperationResultInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExportTemplateRequest.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExportTemplateRequest.java new file mode 100644 index 0000000000000..8a1578d23bb55 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExportTemplateRequest.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Export resource group template request parameters. */ +@Fluent +public final class ExportTemplateRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExportTemplateRequest.class); + + /* + * The IDs of the resources to filter the export by. To export all + * resources, supply an array with single entry '*'. + */ + @JsonProperty(value = "resources") + private List resources; + + /* + * The export template options. A CSV-formatted list containing zero or + * more of the following: 'IncludeParameterDefaultValue', + * 'IncludeComments', 'SkipResourceNameParameterization', + * 'SkipAllParameterization' + */ + @JsonProperty(value = "options") + private String options; + + /** + * Get the resources property: The IDs of the resources to filter the export by. To export all resources, supply an + * array with single entry '*'. + * + * @return the resources value. + */ + public List resources() { + return this.resources; + } + + /** + * Set the resources property: The IDs of the resources to filter the export by. To export all resources, supply an + * array with single entry '*'. + * + * @param resources the resources value to set. + * @return the ExportTemplateRequest object itself. + */ + public ExportTemplateRequest withResources(List resources) { + this.resources = resources; + return this; + } + + /** + * Get the options property: The export template options. A CSV-formatted list containing zero or more of the + * following: 'IncludeParameterDefaultValue', 'IncludeComments', 'SkipResourceNameParameterization', + * 'SkipAllParameterization'. + * + * @return the options value. + */ + public String options() { + return this.options; + } + + /** + * Set the options property: The export template options. A CSV-formatted list containing zero or more of the + * following: 'IncludeParameterDefaultValue', 'IncludeComments', 'SkipResourceNameParameterization', + * 'SkipAllParameterization'. + * + * @param options the options value to set. + * @return the ExportTemplateRequest object itself. + */ + public ExportTemplateRequest withOptions(String options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExpressionEvaluationOptions.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExpressionEvaluationOptions.java new file mode 100644 index 0000000000000..9bd1888164a2d --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExpressionEvaluationOptions.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.resources.generated.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; + +/** Specifies whether template expressions are evaluated within the scope of the parent template or nested template. */ +@Fluent +public final class ExpressionEvaluationOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExpressionEvaluationOptions.class); + + /* + * The scope to be used for evaluation of parameters, variables and + * functions in a nested template. + */ + @JsonProperty(value = "scope") + private ExpressionEvaluationOptionsScopeType scope; + + /** + * Get the scope property: The scope to be used for evaluation of parameters, variables and functions in a nested + * template. + * + * @return the scope value. + */ + public ExpressionEvaluationOptionsScopeType scope() { + return this.scope; + } + + /** + * Set the scope property: The scope to be used for evaluation of parameters, variables and functions in a nested + * template. + * + * @param scope the scope value to set. + * @return the ExpressionEvaluationOptions object itself. + */ + public ExpressionEvaluationOptions withScope(ExpressionEvaluationOptionsScopeType scope) { + this.scope = scope; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExpressionEvaluationOptionsScopeType.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExpressionEvaluationOptionsScopeType.java new file mode 100644 index 0000000000000..344d3d873b91d --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExpressionEvaluationOptionsScopeType.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.resources.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExpressionEvaluationOptionsScopeType. */ +public final class ExpressionEvaluationOptionsScopeType + extends ExpandableStringEnum { + /** Static value NotSpecified for ExpressionEvaluationOptionsScopeType. */ + public static final ExpressionEvaluationOptionsScopeType NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Outer for ExpressionEvaluationOptionsScopeType. */ + public static final ExpressionEvaluationOptionsScopeType OUTER = fromString("Outer"); + + /** Static value Inner for ExpressionEvaluationOptionsScopeType. */ + public static final ExpressionEvaluationOptionsScopeType INNER = fromString("Inner"); + + /** + * Creates or finds a ExpressionEvaluationOptionsScopeType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExpressionEvaluationOptionsScopeType. + */ + @JsonCreator + public static ExpressionEvaluationOptionsScopeType fromString(String name) { + return fromString(name, ExpressionEvaluationOptionsScopeType.class); + } + + /** @return known ExpressionEvaluationOptionsScopeType values. */ + public static Collection values() { + return values(ExpressionEvaluationOptionsScopeType.class); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExtendedLocation.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExtendedLocation.java new file mode 100644 index 0000000000000..b62e99d366ec3 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExtendedLocation.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.resources.generated.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; + +/** Resource extended location. */ +@Fluent +public final class ExtendedLocation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtendedLocation.class); + + /* + * The extended location type. + */ + @JsonProperty(value = "type") + private ExtendedLocationType type; + + /* + * The extended location name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the type property: The extended location type. + * + * @return the type value. + */ + public ExtendedLocationType type() { + return this.type; + } + + /** + * Set the type property: The extended location type. + * + * @param type the type value to set. + * @return the ExtendedLocation object itself. + */ + public ExtendedLocation withType(ExtendedLocationType type) { + this.type = type; + return this; + } + + /** + * Get the name property: The extended location name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The extended location name. + * + * @param name the name value to set. + * @return the ExtendedLocation object itself. + */ + public ExtendedLocation 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExtendedLocationType.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExtendedLocationType.java new file mode 100644 index 0000000000000..706ae6844823e --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ExtendedLocationType.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.resources.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExtendedLocationType. */ +public final class ExtendedLocationType extends ExpandableStringEnum { + /** Static value EdgeZone for ExtendedLocationType. */ + public static final ExtendedLocationType EDGE_ZONE = fromString("EdgeZone"); + + /** + * Creates or finds a ExtendedLocationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExtendedLocationType. + */ + @JsonCreator + public static ExtendedLocationType fromString(String name) { + return fromString(name, ExtendedLocationType.class); + } + + /** @return known ExtendedLocationType values. */ + public static Collection values() { + return values(ExtendedLocationType.class); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/GenericResource.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/GenericResource.java new file mode 100644 index 0000000000000..758c881154c76 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/GenericResource.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.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceInner; +import java.util.Map; + +/** An immutable client-side representation of GenericResource. */ +public interface GenericResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the plan property: The plan of the resource. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the properties property: The resource properties. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the kind property: The kind of the resource. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the managedBy property: ID of the resource that manages this resource. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the sku property: The SKU of the resource. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the identity property: The identity of the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the extendedLocation property: Resource extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceInner object. + * + * @return the inner object. + */ + GenericResourceInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/GenericResourceExpanded.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/GenericResourceExpanded.java new file mode 100644 index 0000000000000..fd427a37e0a98 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/GenericResourceExpanded.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceExpandedInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of GenericResourceExpanded. */ +public interface GenericResourceExpanded { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the plan property: The plan of the resource. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the properties property: The resource properties. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the kind property: The kind of the resource. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the managedBy property: ID of the resource that manages this resource. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the sku property: The SKU of the resource. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the identity property: The identity of the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the extendedLocation property: Resource extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the createdTime property: The created time of the resource. This is only present if requested via the + * $expand query parameter. + * + * @return the createdTime value. + */ + OffsetDateTime createdTime(); + + /** + * Gets the changedTime property: The changed time of the resource. This is only present if requested via the + * $expand query parameter. + * + * @return the changedTime value. + */ + OffsetDateTime changedTime(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. This is only present if requested + * via the $expand query parameter. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceExpandedInner object. + * + * @return the inner object. + */ + GenericResourceExpandedInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/HttpMessage.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/HttpMessage.java new file mode 100644 index 0000000000000..bc67039ee814c --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/HttpMessage.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** HTTP message. */ +@Fluent +public final class HttpMessage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HttpMessage.class); + + /* + * HTTP message content. + */ + @JsonProperty(value = "content") + private Object content; + + /** + * Get the content property: HTTP message content. + * + * @return the content value. + */ + public Object content() { + return this.content; + } + + /** + * Set the content property: HTTP message content. + * + * @param content the content value to set. + * @return the HttpMessage object itself. + */ + public HttpMessage withContent(Object content) { + this.content = content; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Identity.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Identity.java new file mode 100644 index 0000000000000..545dfa93488cf --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Identity.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Identity for the resource. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The identity type. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /* + * The list of user identities associated with the resource. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Get the principalId property: The principal ID of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the Identity object itself. + */ + public Identity withUserAssignedIdentities( + Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/IdentityUserAssignedIdentitiesValue.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/IdentityUserAssignedIdentitiesValue.java new file mode 100644 index 0000000000000..bbaf3d3e52e5d --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/IdentityUserAssignedIdentitiesValue.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The IdentityUserAssignedIdentitiesValue model. */ +@Immutable +public final class IdentityUserAssignedIdentitiesValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IdentityUserAssignedIdentitiesValue.class); + + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OnErrorDeployment.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OnErrorDeployment.java new file mode 100644 index 0000000000000..27937d083063c --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OnErrorDeployment.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.resources.generated.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; + +/** Deployment on error behavior. */ +@Fluent +public final class OnErrorDeployment { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OnErrorDeployment.class); + + /* + * The deployment on error behavior type. Possible values are + * LastSuccessful and SpecificDeployment. + */ + @JsonProperty(value = "type") + private OnErrorDeploymentType type; + + /* + * The deployment to be used on error case. + */ + @JsonProperty(value = "deploymentName") + private String deploymentName; + + /** + * Get the type property: The deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. + * + * @return the type value. + */ + public OnErrorDeploymentType type() { + return this.type; + } + + /** + * Set the type property: The deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. + * + * @param type the type value to set. + * @return the OnErrorDeployment object itself. + */ + public OnErrorDeployment withType(OnErrorDeploymentType type) { + this.type = type; + return this; + } + + /** + * Get the deploymentName property: The deployment to be used on error case. + * + * @return the deploymentName value. + */ + public String deploymentName() { + return this.deploymentName; + } + + /** + * Set the deploymentName property: The deployment to be used on error case. + * + * @param deploymentName the deploymentName value to set. + * @return the OnErrorDeployment object itself. + */ + public OnErrorDeployment withDeploymentName(String deploymentName) { + this.deploymentName = deploymentName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OnErrorDeploymentExtended.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OnErrorDeploymentExtended.java new file mode 100644 index 0000000000000..313080aa55cc1 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OnErrorDeploymentExtended.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Deployment on error behavior with additional details. */ +@Fluent +public final class OnErrorDeploymentExtended { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OnErrorDeploymentExtended.class); + + /* + * The state of the provisioning for the on error deployment. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The deployment on error behavior type. Possible values are + * LastSuccessful and SpecificDeployment. + */ + @JsonProperty(value = "type") + private OnErrorDeploymentType type; + + /* + * The deployment to be used on error case. + */ + @JsonProperty(value = "deploymentName") + private String deploymentName; + + /** + * Get the provisioningState property: The state of the provisioning for the on error deployment. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the type property: The deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. + * + * @return the type value. + */ + public OnErrorDeploymentType type() { + return this.type; + } + + /** + * Set the type property: The deployment on error behavior type. Possible values are LastSuccessful and + * SpecificDeployment. + * + * @param type the type value to set. + * @return the OnErrorDeploymentExtended object itself. + */ + public OnErrorDeploymentExtended withType(OnErrorDeploymentType type) { + this.type = type; + return this; + } + + /** + * Get the deploymentName property: The deployment to be used on error case. + * + * @return the deploymentName value. + */ + public String deploymentName() { + return this.deploymentName; + } + + /** + * Set the deploymentName property: The deployment to be used on error case. + * + * @param deploymentName the deploymentName value to set. + * @return the OnErrorDeploymentExtended object itself. + */ + public OnErrorDeploymentExtended withDeploymentName(String deploymentName) { + this.deploymentName = deploymentName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OnErrorDeploymentType.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OnErrorDeploymentType.java new file mode 100644 index 0000000000000..48d4174266297 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OnErrorDeploymentType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for OnErrorDeploymentType. */ +public enum OnErrorDeploymentType { + /** Enum value LastSuccessful. */ + LAST_SUCCESSFUL("LastSuccessful"), + + /** Enum value SpecificDeployment. */ + SPECIFIC_DEPLOYMENT("SpecificDeployment"); + + /** The actual serialized value for a OnErrorDeploymentType instance. */ + private final String value; + + OnErrorDeploymentType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OnErrorDeploymentType instance. + * + * @param value the serialized value to parse. + * @return the parsed OnErrorDeploymentType object, or null if unable to parse. + */ + @JsonCreator + public static OnErrorDeploymentType fromString(String value) { + OnErrorDeploymentType[] items = OnErrorDeploymentType.values(); + for (OnErrorDeploymentType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Operation.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Operation.java new file mode 100644 index 0000000000000..d12ed35837fb2 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Operation.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.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OperationDisplay.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OperationDisplay.java new file mode 100644 index 0000000000000..5d43b68cfc596 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OperationDisplay.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.resources.generated.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 object that represents the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft.Resources + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Service provider: Microsoft.Resources. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft.Resources. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation type: Read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type: Read, write, delete, etc. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OperationListResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OperationListResult.java new file mode 100644 index 0000000000000..c18544defae56 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/OperationListResult.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.resources.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get + * the next set of results. + */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of Microsoft.Resources operations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of Microsoft.Resources operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Microsoft.Resources operations. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Operations.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Operations.java new file mode 100644 index 0000000000000..6443508f6c3f6 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Operations.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.resources.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available Microsoft.Resources REST API 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 result of the request to list Microsoft.Resources operations as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the available Microsoft.Resources REST API 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 result of the request to list Microsoft.Resources operations as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ParametersLink.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ParametersLink.java new file mode 100644 index 0000000000000..f0c9141c0e473 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ParametersLink.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.resources.generated.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; + +/** Entity representing the reference to the deployment parameters. */ +@Fluent +public final class ParametersLink { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ParametersLink.class); + + /* + * The URI of the parameters file. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /* + * If included, must match the ContentVersion in the template. + */ + @JsonProperty(value = "contentVersion") + private String contentVersion; + + /** + * Get the uri property: The URI of the parameters file. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The URI of the parameters file. + * + * @param uri the uri value to set. + * @return the ParametersLink object itself. + */ + public ParametersLink withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the contentVersion property: If included, must match the ContentVersion in the template. + * + * @return the contentVersion value. + */ + public String contentVersion() { + return this.contentVersion; + } + + /** + * Set the contentVersion property: If included, must match the ContentVersion in the template. + * + * @param contentVersion the contentVersion value to set. + * @return the ParametersLink object itself. + */ + public ParametersLink withContentVersion(String contentVersion) { + this.contentVersion = contentVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (uri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property uri in model ParametersLink")); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Permission.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Permission.java new file mode 100644 index 0000000000000..b28d227c4afd7 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Permission.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Role definition permissions. */ +@Fluent +public final class Permission { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Permission.class); + + /* + * Allowed actions. + */ + @JsonProperty(value = "actions") + private List actions; + + /* + * Denied actions. + */ + @JsonProperty(value = "notActions") + private List notActions; + + /* + * Allowed Data actions. + */ + @JsonProperty(value = "dataActions") + private List dataActions; + + /* + * Denied Data actions. + */ + @JsonProperty(value = "notDataActions") + private List notDataActions; + + /** + * Get the actions property: Allowed actions. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: Allowed actions. + * + * @param actions the actions value to set. + * @return the Permission object itself. + */ + public Permission withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the notActions property: Denied actions. + * + * @return the notActions value. + */ + public List notActions() { + return this.notActions; + } + + /** + * Set the notActions property: Denied actions. + * + * @param notActions the notActions value to set. + * @return the Permission object itself. + */ + public Permission withNotActions(List notActions) { + this.notActions = notActions; + return this; + } + + /** + * Get the dataActions property: Allowed Data actions. + * + * @return the dataActions value. + */ + public List dataActions() { + return this.dataActions; + } + + /** + * Set the dataActions property: Allowed Data actions. + * + * @param dataActions the dataActions value to set. + * @return the Permission object itself. + */ + public Permission withDataActions(List dataActions) { + this.dataActions = dataActions; + return this; + } + + /** + * Get the notDataActions property: Denied Data actions. + * + * @return the notDataActions value. + */ + public List notDataActions() { + return this.notDataActions; + } + + /** + * Set the notDataActions property: Denied Data actions. + * + * @param notDataActions the notDataActions value to set. + * @return the Permission object itself. + */ + public Permission withNotDataActions(List notDataActions) { + this.notDataActions = notDataActions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Plan.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Plan.java new file mode 100644 index 0000000000000..04ab409a6abc2 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Plan.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Plan for the resource. */ +@Fluent +public final class Plan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Plan.class); + + /* + * The plan ID. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The publisher ID. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * The offer ID. + */ + @JsonProperty(value = "product") + private String product; + + /* + * The promotion code. + */ + @JsonProperty(value = "promotionCode") + private String promotionCode; + + /* + * The plan's version. + */ + @JsonProperty(value = "version") + private String version; + + /** + * 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 Plan object itself. + */ + public Plan withName(String name) { + this.name = name; + return this; + } + + /** + * 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 Plan object itself. + */ + public Plan 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 Plan object itself. + */ + public Plan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotionCode property: The promotion code. + * + * @return the promotionCode value. + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotionCode property: The promotion code. + * + * @param promotionCode the promotionCode value to set. + * @return the Plan object itself. + */ + public Plan withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Get the version property: The plan's version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The plan's version. + * + * @param version the version value to set. + * @return the Plan object itself. + */ + public Plan withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/PropertyChangeType.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/PropertyChangeType.java new file mode 100644 index 0000000000000..dd8e9b0a3d3fa --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/PropertyChangeType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for PropertyChangeType. */ +public enum PropertyChangeType { + /** Enum value Create. */ + CREATE("Create"), + + /** Enum value Delete. */ + DELETE("Delete"), + + /** Enum value Modify. */ + MODIFY("Modify"), + + /** Enum value Array. */ + ARRAY("Array"), + + /** Enum value NoEffect. */ + NO_EFFECT("NoEffect"); + + /** The actual serialized value for a PropertyChangeType instance. */ + private final String value; + + PropertyChangeType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PropertyChangeType instance. + * + * @param value the serialized value to parse. + * @return the parsed PropertyChangeType object, or null if unable to parse. + */ + @JsonCreator + public static PropertyChangeType fromString(String value) { + PropertyChangeType[] items = PropertyChangeType.values(); + for (PropertyChangeType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Provider.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Provider.java new file mode 100644 index 0000000000000..66de8e3309113 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Provider.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.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderInner; +import java.util.List; + +/** An immutable client-side representation of Provider. */ +public interface Provider { + /** + * Gets the id property: The provider ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the namespace property: The namespace of the resource provider. + * + * @return the namespace value. + */ + String namespace(); + + /** + * Gets the registrationState property: The registration state of the resource provider. + * + * @return the registrationState value. + */ + String registrationState(); + + /** + * Gets the registrationPolicy property: The registration policy of the resource provider. + * + * @return the registrationPolicy value. + */ + String registrationPolicy(); + + /** + * Gets the resourceTypes property: The collection of provider resource types. + * + * @return the resourceTypes value. + */ + List resourceTypes(); + + /** + * Gets the providerAuthorizationConsentState property: The provider authorization consent state. + * + * @return the providerAuthorizationConsentState value. + */ + ProviderAuthorizationConsentState providerAuthorizationConsentState(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.ProviderInner object. + * + * @return the inner object. + */ + ProviderInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderAuthorizationConsentState.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderAuthorizationConsentState.java new file mode 100644 index 0000000000000..657e4ffa7685f --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderAuthorizationConsentState.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProviderAuthorizationConsentState. */ +public final class ProviderAuthorizationConsentState extends ExpandableStringEnum { + /** Static value NotSpecified for ProviderAuthorizationConsentState. */ + public static final ProviderAuthorizationConsentState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Required for ProviderAuthorizationConsentState. */ + public static final ProviderAuthorizationConsentState REQUIRED = fromString("Required"); + + /** Static value NotRequired for ProviderAuthorizationConsentState. */ + public static final ProviderAuthorizationConsentState NOT_REQUIRED = fromString("NotRequired"); + + /** Static value Consented for ProviderAuthorizationConsentState. */ + public static final ProviderAuthorizationConsentState CONSENTED = fromString("Consented"); + + /** + * Creates or finds a ProviderAuthorizationConsentState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProviderAuthorizationConsentState. + */ + @JsonCreator + public static ProviderAuthorizationConsentState fromString(String name) { + return fromString(name, ProviderAuthorizationConsentState.class); + } + + /** @return known ProviderAuthorizationConsentState values. */ + public static Collection values() { + return values(ProviderAuthorizationConsentState.class); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderConsentDefinition.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderConsentDefinition.java new file mode 100644 index 0000000000000..4210e4654ab64 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderConsentDefinition.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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 provider consent. */ +@Fluent +public final class ProviderConsentDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderConsentDefinition.class); + + /* + * A value indicating whether authorization is consented or not. + */ + @JsonProperty(value = "consentToAuthorization") + private Boolean consentToAuthorization; + + /** + * Get the consentToAuthorization property: A value indicating whether authorization is consented or not. + * + * @return the consentToAuthorization value. + */ + public Boolean consentToAuthorization() { + return this.consentToAuthorization; + } + + /** + * Set the consentToAuthorization property: A value indicating whether authorization is consented or not. + * + * @param consentToAuthorization the consentToAuthorization value to set. + * @return the ProviderConsentDefinition object itself. + */ + public ProviderConsentDefinition withConsentToAuthorization(Boolean consentToAuthorization) { + this.consentToAuthorization = consentToAuthorization; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderExtendedLocation.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderExtendedLocation.java new file mode 100644 index 0000000000000..308acedead0bf --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderExtendedLocation.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** The provider extended location. */ +@Fluent +public final class ProviderExtendedLocation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderExtendedLocation.class); + + /* + * The azure location. + */ + @JsonProperty(value = "location") + private String location; + + /* + * The extended location type. + */ + @JsonProperty(value = "type") + private String type; + + /* + * The extended locations for the azure location. + */ + @JsonProperty(value = "extendedLocations") + private List extendedLocations; + + /** + * Get the location property: The azure location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The azure location. + * + * @param location the location value to set. + * @return the ProviderExtendedLocation object itself. + */ + public ProviderExtendedLocation withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the type property: The extended location type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The extended location type. + * + * @param type the type value to set. + * @return the ProviderExtendedLocation object itself. + */ + public ProviderExtendedLocation withType(String type) { + this.type = type; + return this; + } + + /** + * Get the extendedLocations property: The extended locations for the azure location. + * + * @return the extendedLocations value. + */ + public List extendedLocations() { + return this.extendedLocations; + } + + /** + * Set the extendedLocations property: The extended locations for the azure location. + * + * @param extendedLocations the extendedLocations value to set. + * @return the ProviderExtendedLocation object itself. + */ + public ProviderExtendedLocation withExtendedLocations(List extendedLocations) { + this.extendedLocations = extendedLocations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderListResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderListResult.java new file mode 100644 index 0000000000000..0f5e809224076 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of resource providers. */ +@Fluent +public final class ProviderListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderListResult.class); + + /* + * An array of resource providers. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: An array of resource providers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of resource providers. + * + * @param value the value value to set. + * @return the ProviderListResult object itself. + */ + public ProviderListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderPermission.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderPermission.java new file mode 100644 index 0000000000000..e823c4b11247e --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderPermission.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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 provider permission. */ +@Fluent +public final class ProviderPermission { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderPermission.class); + + /* + * The application id. + */ + @JsonProperty(value = "applicationId") + private String applicationId; + + /* + * Role definition properties. + */ + @JsonProperty(value = "roleDefinition") + private RoleDefinition roleDefinition; + + /* + * Role definition properties. + */ + @JsonProperty(value = "managedByRoleDefinition") + private RoleDefinition managedByRoleDefinition; + + /* + * The provider authorization consent state. + */ + @JsonProperty(value = "providerAuthorizationConsentState") + private ProviderAuthorizationConsentState providerAuthorizationConsentState; + + /** + * Get the applicationId property: The application id. + * + * @return the applicationId value. + */ + public String applicationId() { + return this.applicationId; + } + + /** + * Set the applicationId property: The application id. + * + * @param applicationId the applicationId value to set. + * @return the ProviderPermission object itself. + */ + public ProviderPermission withApplicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get the roleDefinition property: Role definition properties. + * + * @return the roleDefinition value. + */ + public RoleDefinition roleDefinition() { + return this.roleDefinition; + } + + /** + * Set the roleDefinition property: Role definition properties. + * + * @param roleDefinition the roleDefinition value to set. + * @return the ProviderPermission object itself. + */ + public ProviderPermission withRoleDefinition(RoleDefinition roleDefinition) { + this.roleDefinition = roleDefinition; + return this; + } + + /** + * Get the managedByRoleDefinition property: Role definition properties. + * + * @return the managedByRoleDefinition value. + */ + public RoleDefinition managedByRoleDefinition() { + return this.managedByRoleDefinition; + } + + /** + * Set the managedByRoleDefinition property: Role definition properties. + * + * @param managedByRoleDefinition the managedByRoleDefinition value to set. + * @return the ProviderPermission object itself. + */ + public ProviderPermission withManagedByRoleDefinition(RoleDefinition managedByRoleDefinition) { + this.managedByRoleDefinition = managedByRoleDefinition; + return this; + } + + /** + * Get the providerAuthorizationConsentState property: The provider authorization consent state. + * + * @return the providerAuthorizationConsentState value. + */ + public ProviderAuthorizationConsentState providerAuthorizationConsentState() { + return this.providerAuthorizationConsentState; + } + + /** + * Set the providerAuthorizationConsentState property: The provider authorization consent state. + * + * @param providerAuthorizationConsentState the providerAuthorizationConsentState value to set. + * @return the ProviderPermission object itself. + */ + public ProviderPermission withProviderAuthorizationConsentState( + ProviderAuthorizationConsentState providerAuthorizationConsentState) { + this.providerAuthorizationConsentState = providerAuthorizationConsentState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (roleDefinition() != null) { + roleDefinition().validate(); + } + if (managedByRoleDefinition() != null) { + managedByRoleDefinition().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderPermissionListResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderPermissionListResult.java new file mode 100644 index 0000000000000..4b04b5a5c6d44 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderPermissionListResult.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.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderPermissionListResultInner; +import java.util.List; + +/** An immutable client-side representation of ProviderPermissionListResult. */ +public interface ProviderPermissionListResult { + /** + * Gets the value property: An array of provider permissions. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.ProviderPermissionListResultInner + * object. + * + * @return the inner object. + */ + ProviderPermissionListResultInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderRegistrationRequest.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderRegistrationRequest.java new file mode 100644 index 0000000000000..8076ac766b7a1 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderRegistrationRequest.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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 provider registration definition. */ +@Fluent +public final class ProviderRegistrationRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderRegistrationRequest.class); + + /* + * The provider consent. + */ + @JsonProperty(value = "thirdPartyProviderConsent") + private ProviderConsentDefinition thirdPartyProviderConsent; + + /** + * Get the thirdPartyProviderConsent property: The provider consent. + * + * @return the thirdPartyProviderConsent value. + */ + public ProviderConsentDefinition thirdPartyProviderConsent() { + return this.thirdPartyProviderConsent; + } + + /** + * Set the thirdPartyProviderConsent property: The provider consent. + * + * @param thirdPartyProviderConsent the thirdPartyProviderConsent value to set. + * @return the ProviderRegistrationRequest object itself. + */ + public ProviderRegistrationRequest withThirdPartyProviderConsent( + ProviderConsentDefinition thirdPartyProviderConsent) { + this.thirdPartyProviderConsent = thirdPartyProviderConsent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (thirdPartyProviderConsent() != null) { + thirdPartyProviderConsent().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderResourceType.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderResourceType.java new file mode 100644 index 0000000000000..46e60bf27132e --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderResourceType.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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.List; +import java.util.Map; + +/** Resource type managed by the resource provider. */ +@Fluent +public final class ProviderResourceType { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderResourceType.class); + + /* + * The resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * The collection of locations where this resource type can be created. + */ + @JsonProperty(value = "locations") + private List locations; + + /* + * The location mappings that are supported by this resource type. + */ + @JsonProperty(value = "locationMappings") + private List locationMappings; + + /* + * The aliases that are supported by this resource type. + */ + @JsonProperty(value = "aliases") + private List aliases; + + /* + * The API version. + */ + @JsonProperty(value = "apiVersions") + private List apiVersions; + + /* + * The default API version. + */ + @JsonProperty(value = "defaultApiVersion", access = JsonProperty.Access.WRITE_ONLY) + private String defaultApiVersion; + + /* + * The zoneMappings property. + */ + @JsonProperty(value = "zoneMappings") + private List zoneMappings; + + /* + * The API profiles for the resource provider. + */ + @JsonProperty(value = "apiProfiles", access = JsonProperty.Access.WRITE_ONLY) + private List apiProfiles; + + /* + * The additional capabilities offered by this resource type. + */ + @JsonProperty(value = "capabilities") + private String capabilities; + + /* + * The properties. + */ + @JsonProperty(value = "properties") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /** + * Get the resourceType property: The resource type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: The resource type. + * + * @param resourceType the resourceType value to set. + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the locations property: The collection of locations where this resource type can be created. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: The collection of locations where this resource type can be created. + * + * @param locations the locations value to set. + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the locationMappings property: The location mappings that are supported by this resource type. + * + * @return the locationMappings value. + */ + public List locationMappings() { + return this.locationMappings; + } + + /** + * Set the locationMappings property: The location mappings that are supported by this resource type. + * + * @param locationMappings the locationMappings value to set. + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withLocationMappings(List locationMappings) { + this.locationMappings = locationMappings; + return this; + } + + /** + * Get the aliases property: The aliases that are supported by this resource type. + * + * @return the aliases value. + */ + public List aliases() { + return this.aliases; + } + + /** + * Set the aliases property: The aliases that are supported by this resource type. + * + * @param aliases the aliases value to set. + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withAliases(List aliases) { + this.aliases = aliases; + return this; + } + + /** + * Get the apiVersions property: The API version. + * + * @return the apiVersions value. + */ + public List apiVersions() { + return this.apiVersions; + } + + /** + * Set the apiVersions property: The API version. + * + * @param apiVersions the apiVersions value to set. + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withApiVersions(List apiVersions) { + this.apiVersions = apiVersions; + return this; + } + + /** + * Get the defaultApiVersion property: The default API version. + * + * @return the defaultApiVersion value. + */ + public String defaultApiVersion() { + return this.defaultApiVersion; + } + + /** + * Get the zoneMappings property: The zoneMappings property. + * + * @return the zoneMappings value. + */ + public List zoneMappings() { + return this.zoneMappings; + } + + /** + * Set the zoneMappings property: The zoneMappings property. + * + * @param zoneMappings the zoneMappings value to set. + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withZoneMappings(List zoneMappings) { + this.zoneMappings = zoneMappings; + return this; + } + + /** + * Get the apiProfiles property: The API profiles for the resource provider. + * + * @return the apiProfiles value. + */ + public List apiProfiles() { + return this.apiProfiles; + } + + /** + * Get the capabilities property: The additional capabilities offered by this resource type. + * + * @return the capabilities value. + */ + public String capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities property: The additional capabilities offered by this resource type. + * + * @param capabilities the capabilities value to set. + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withCapabilities(String capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the properties property: The properties. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties property: The properties. + * + * @param properties the properties value to set. + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (locationMappings() != null) { + locationMappings().forEach(e -> e.validate()); + } + if (aliases() != null) { + aliases().forEach(e -> e.validate()); + } + if (zoneMappings() != null) { + zoneMappings().forEach(e -> e.validate()); + } + if (apiProfiles() != null) { + apiProfiles().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderResourceTypeListResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderResourceTypeListResult.java new file mode 100644 index 0000000000000..bd6e67ab69575 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderResourceTypeListResult.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.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.ProviderResourceTypeListResultInner; +import java.util.List; + +/** An immutable client-side representation of ProviderResourceTypeListResult. */ +public interface ProviderResourceTypeListResult { + /** + * Gets the value property: An array of resource types. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.ProviderResourceTypeListResultInner + * object. + * + * @return the inner object. + */ + ProviderResourceTypeListResultInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderResourceTypes.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderResourceTypes.java new file mode 100644 index 0000000000000..b48a9cf872f60 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProviderResourceTypes.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.resources.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ProviderResourceTypes. */ +public interface ProviderResourceTypes { + /** + * List the resource types for a specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @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 list of resource types of a resource provider. + */ + ProviderResourceTypeListResult list(String resourceProviderNamespace); + + /** + * List the resource types for a specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 list of resource types of a resource provider along with {@link Response}. + */ + Response listWithResponse( + String resourceProviderNamespace, String expand, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Providers.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Providers.java new file mode 100644 index 0000000000000..df57ce9bf5c10 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Providers.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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 Providers. */ +public interface Providers { + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @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 resource provider information. + */ + Provider unregister(String resourceProviderNamespace); + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @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 resource provider information along with {@link Response}. + */ + Response unregisterWithResponse(String resourceProviderNamespace, Context context); + + /** + * Registers a management group with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param groupId The management group 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 registerAtManagementGroupScope(String resourceProviderNamespace, String groupId); + + /** + * Registers a management group with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param groupId The management group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response registerAtManagementGroupScopeWithResponse( + String resourceProviderNamespace, String groupId, Context context); + + /** + * Get the provider permissions. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @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 provider permissions. + */ + ProviderPermissionListResult providerPermissions(String resourceProviderNamespace); + + /** + * Get the provider permissions. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the provider permissions along with {@link Response}. + */ + Response providerPermissionsWithResponse( + String resourceProviderNamespace, Context context); + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @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 resource provider information. + */ + Provider register(String resourceProviderNamespace); + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @param properties The third party consent for S2S. + * @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 resource provider information along with {@link Response}. + */ + Response registerWithResponse( + String resourceProviderNamespace, ProviderRegistrationRequest properties, Context context); + + /** + * Gets all resource providers for a 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 all resource providers for a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets all resource providers for a subscription. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 resource providers for a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String expand, Context context); + + /** + * Gets all resource providers for the tenant. + * + * @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 resource providers for the tenant as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtTenantScope(); + + /** + * Gets all resource providers for the tenant. + * + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query + * string to retrieve resource provider metadata. To include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 resource providers for the tenant as paginated response with {@link PagedIterable}. + */ + PagedIterable listAtTenantScope(String expand, Context context); + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @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 specified resource provider. + */ + Provider get(String resourceProviderNamespace); + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 specified resource provider along with {@link Response}. + */ + Response getWithResponse(String resourceProviderNamespace, String expand, Context context); + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @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 specified resource provider at the tenant level. + */ + Provider getAtTenantScope(String resourceProviderNamespace); + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use + * $expand=resourceTypes/aliases. + * @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 specified resource provider at the tenant level along with {@link Response}. + */ + Response getAtTenantScopeWithResponse(String resourceProviderNamespace, String expand, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProvisioningOperation.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProvisioningOperation.java new file mode 100644 index 0000000000000..92afe681ca00c --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProvisioningOperation.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ProvisioningOperation. */ +public enum ProvisioningOperation { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value Create. */ + CREATE("Create"), + + /** Enum value Delete. */ + DELETE("Delete"), + + /** Enum value Waiting. */ + WAITING("Waiting"), + + /** Enum value AzureAsyncOperationWaiting. */ + AZURE_ASYNC_OPERATION_WAITING("AzureAsyncOperationWaiting"), + + /** Enum value ResourceCacheWaiting. */ + RESOURCE_CACHE_WAITING("ResourceCacheWaiting"), + + /** Enum value Action. */ + ACTION("Action"), + + /** Enum value Read. */ + READ("Read"), + + /** Enum value EvaluateDeploymentOutput. */ + EVALUATE_DEPLOYMENT_OUTPUT("EvaluateDeploymentOutput"), + + /** Enum value DeploymentCleanup. */ + DEPLOYMENT_CLEANUP("DeploymentCleanup"); + + /** The actual serialized value for a ProvisioningOperation instance. */ + private final String value; + + ProvisioningOperation(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningOperation instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningOperation object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningOperation fromString(String value) { + ProvisioningOperation[] items = ProvisioningOperation.values(); + for (ProvisioningOperation item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProvisioningState.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProvisioningState.java new file mode 100644 index 0000000000000..44d0d13468f63 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ProvisioningState.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value NotSpecified for ProvisioningState. */ + public static final ProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Running for ProvisioningState. */ + public static final ProvisioningState RUNNING = fromString("Running"); + + /** Static value Ready for ProvisioningState. */ + public static final ProvisioningState READY = fromString("Ready"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Created for ProvisioningState. */ + public static final ProvisioningState CREATED = fromString("Created"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Deleted for ProvisioningState. */ + public static final ProvisioningState DELETED = fromString("Deleted"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroup.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroup.java new file mode 100644 index 0000000000000..49e145e042343 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroup.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupInner; +import java.util.Map; + +/** An immutable client-side representation of ResourceGroup. */ +public interface ResourceGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource group properties. + * + * @return the properties value. + */ + ResourceGroupProperties properties(); + + /** + * Gets the managedBy property: The ID of the resource that manages this resource group. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupInner object. + * + * @return the inner object. + */ + ResourceGroupInner innerModel(); + + /** The entirety of the ResourceGroup definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + /** The ResourceGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the ResourceGroup definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ResourceGroup definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** + * The stage of the ResourceGroup definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithManagedBy { + /** + * Executes the create request. + * + * @return the created resource. + */ + ResourceGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ResourceGroup create(Context context); + } + /** The stage of the ResourceGroup definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ResourceGroup definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The resource group properties.. + * + * @param properties The resource group properties. + * @return the next definition stage. + */ + WithCreate withProperties(ResourceGroupProperties properties); + } + /** The stage of the ResourceGroup definition allowing to specify managedBy. */ + interface WithManagedBy { + /** + * Specifies the managedBy property: The ID of the resource that manages this resource group.. + * + * @param managedBy The ID of the resource that manages this resource group. + * @return the next definition stage. + */ + WithCreate withManagedBy(String managedBy); + } + } + /** + * Begins update for the ResourceGroup resource. + * + * @return the stage of resource update. + */ + ResourceGroup.Update update(); + + /** The template for ResourceGroup update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithName, UpdateStages.WithProperties, UpdateStages.WithManagedBy { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ResourceGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ResourceGroup apply(Context context); + } + /** The ResourceGroup update stages. */ + interface UpdateStages { + /** The stage of the ResourceGroup update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags attached to the resource group.. + * + * @param tags The tags attached to the resource group. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ResourceGroup update allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: The name of the resource group.. + * + * @param name The name of the resource group. + * @return the next definition stage. + */ + Update withName(String name); + } + /** The stage of the ResourceGroup update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The resource group properties.. + * + * @param properties The resource group properties. + * @return the next definition stage. + */ + Update withProperties(ResourceGroupProperties properties); + } + /** The stage of the ResourceGroup update allowing to specify managedBy. */ + interface WithManagedBy { + /** + * Specifies the managedBy property: The ID of the resource that manages this resource group.. + * + * @param managedBy The ID of the resource that manages this resource group. + * @return the next definition stage. + */ + Update withManagedBy(String managedBy); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ResourceGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ResourceGroup refresh(Context context); + + /** + * Captures the specified resource group as a template. + * + * @param parameters Parameters for exporting the template. + * @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 resource group export result. + */ + ResourceGroupExportResult exportTemplate(ExportTemplateRequest parameters); + + /** + * Captures the specified resource group as a template. + * + * @param parameters Parameters for exporting the template. + * @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 resource group export result. + */ + ResourceGroupExportResult exportTemplate(ExportTemplateRequest parameters, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupExportResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupExportResult.java new file mode 100644 index 0000000000000..52c6119baf04e --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupExportResult.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.resources.generated.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupExportResultInner; + +/** An immutable client-side representation of ResourceGroupExportResult. */ +public interface ResourceGroupExportResult { + /** + * Gets the template property: The template content. + * + * @return the template value. + */ + Object template(); + + /** + * Gets the error property: Error Response The template export error. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupExportResultInner object. + * + * @return the inner object. + */ + ResourceGroupExportResultInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupListResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupListResult.java new file mode 100644 index 0000000000000..c0af770757304 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.fluent.models.ResourceGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of resource groups. */ +@Fluent +public final class ResourceGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGroupListResult.class); + + /* + * An array of resource groups. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: An array of resource groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of resource groups. + * + * @param value the value value to set. + * @return the ResourceGroupListResult object itself. + */ + public ResourceGroupListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupPatchable.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupPatchable.java new file mode 100644 index 0000000000000..8ffbb69c56f81 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupPatchable.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Resource group information. */ +@Fluent +public final class ResourceGroupPatchable { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGroupPatchable.class); + + /* + * The name of the resource group. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The resource group properties. + */ + @JsonProperty(value = "properties") + private ResourceGroupProperties properties; + + /* + * The ID of the resource that manages this resource group. + */ + @JsonProperty(value = "managedBy") + private String managedBy; + + /* + * The tags attached to the resource group. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the name property: The name of the resource group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource group. + * + * @param name the name value to set. + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: The resource group properties. + * + * @return the properties value. + */ + public ResourceGroupProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource group properties. + * + * @param properties the properties value to set. + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withProperties(ResourceGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the managedBy property: The ID of the resource that manages this resource group. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set the managedBy property: The ID of the resource that manages this resource group. + * + * @param managedBy the managedBy value to set. + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + + /** + * Get the tags property: The tags attached to the resource group. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags attached to the resource group. + * + * @param tags the tags value to set. + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupProperties.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupProperties.java new file mode 100644 index 0000000000000..b66da9fd8951e --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroupProperties.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.resources.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource group properties. */ +@Immutable +public final class ResourceGroupProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceGroupProperties.class); + + /* + * The provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroups.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroups.java new file mode 100644 index 0000000000000..551d7dc5d4133 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceGroups.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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 ResourceGroups. */ +public interface ResourceGroups { + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + boolean checkExistence(String resourceGroupName); + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists along with {@link Response}. + */ + Response checkExistenceWithResponse(String resourceGroupName, Context context); + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @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 forceDeletionTypes); + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName); + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @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 forceDeletionTypes, Context context); + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group. + */ + ResourceGroup get(String resourceGroupName); + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, Context context); + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @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 resource group export result. + */ + ResourceGroupExportResult exportTemplate(String resourceGroupName, ExportTemplateRequest parameters); + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @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 resource group export result. + */ + ResourceGroupExportResult exportTemplate( + String resourceGroupName, ExportTemplateRequest parameters, Context context); + + /** + * Gets all the resource groups for a 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 all the resource groups for a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. + * For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 the resource groups for a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String filter, Integer top, Context context); + + /** + * Gets a resource group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group along with {@link Response}. + */ + ResourceGroup getById(String id); + + /** + * Gets a resource group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @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); + + /** + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of + * its template deployments and currently stored operations. + * + * @param id the resource ID. + * @param forceDeletionTypes The resource types you want to force delete. Currently, only the following is + * supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + * @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, String forceDeletionTypes, Context context); + + /** + * Begins definition for a new ResourceGroup resource. + * + * @param name resource name. + * @return the first stage of the new ResourceGroup definition. + */ + ResourceGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceIdentityType.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..362c6344e9bcd --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceIdentityType.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.resources.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value SystemAssigned, UserAssigned. */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned, UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceListResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceListResult.java new file mode 100644 index 0000000000000..6ce949e234a9a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceExpandedInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of resource groups. */ +@Fluent +public final class ResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceListResult.class); + + /* + * An array of resources. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: An array of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of resources. + * + * @param value the value value to set. + * @return the ResourceListResult object itself. + */ + public ResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceReference.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceReference.java new file mode 100644 index 0000000000000..705ec3833bf03 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourceReference.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.resources.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource Id model. */ +@Immutable +public final class ResourceReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceReference.class); + + /* + * The fully qualified resource Id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: The fully qualified resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Resources.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Resources.java new file mode 100644 index 0000000000000..59a815253059a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Resources.java @@ -0,0 +1,550 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.GenericResourceInner; + +/** Resource collection API of Resources. */ +public interface Resources { + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @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 the resources for a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) + * or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, + * plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For + * example, to filter by a resource type, use: $filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the + * filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, + * to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', + * name)<br><br>You can link more than one substringof together by adding and/or + * operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name + * and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + * the tags for each resource are not returned in the results.<br><br>You can use some properties + * together when filtering. The combinations you can use are: substringof and/or resourceType, plan and + * plan/publisher and plan/name, identity and identity/principalId. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns 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 the resources for a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, String filter, String expand, Integer top, Context context); + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving resources. + * @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 sourceResourceGroupName, ResourcesMoveInfo parameters); + + /** + * The resources to be moved must be in the same source resource group in the source subscription being used. The + * target resource group may be in a different subscription. When moving resources, both the source group and the + * target group are locked for the duration of the operation. Write and delete operations are blocked on the groups + * until the move completes. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be moved. + * @param parameters Parameters for moving 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. + */ + void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context); + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving resources. + * @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 sourceResourceGroupName, ResourcesMoveInfo parameters); + + /** + * This operation checks whether the specified resources can be moved to the target. The resources to be moved must + * be in the same source resource group in the source subscription being used. The target resource group may be in a + * different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation + * fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location + * header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group from the source subscription containing the + * resources to be validated for move. + * @param parameters Parameters for moving 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. + */ + void validateMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters, Context context); + + /** + * Get all the resources in a 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 all the resources in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>Filter comparison operators include `eq` + * (equals) and `ne` (not equals) and may be used with the following properties: `location`, `resourceType`, + * `name`, `resourceGroup`, `identity`, `identity/principalId`, `plan`, `plan/publisher`, `plan/product`, + * `plan/name`, `plan/version`, and `plan/promotionCode`.<br><br>For example, to filter by a + * resource type, use `$filter=resourceType eq + * 'Microsoft.Network/virtualNetworks'`<br><br><br>`substringof(value, property)` can be used + * to filter for substrings of the following currently-supported properties: `name` and + * `resourceGroup`<br><br>For example, to get all resources with 'demo' anywhere in the resource + * name, use `$filter=substringof('demo', name)`<br><br>Multiple substring operations can also be + * combined using `and`/`or` operators.<br><br>Note that any truncated number of results queried via + * `$top` may also not be compatible when using a filter.<br><br><br>Resources can be filtered + * by tag names and values. For example, to filter for a tag name and value, use `$filter=tagName eq 'tag1' and + * tagValue eq 'Value1'`. Note that when resources are filtered by tag name and value, <b>the original + * tags for each resource will not be returned in the results.</b> Any list of additional properties + * queried via `$expand` may also not be compatible when filtering by tag names/values. <br><br>For + * tag names only, resources can be filtered by prefix using the following syntax: `$filter=startswith(tagName, + * 'depart')`. This query will return all resources with a tag name prefixed by the phrase `depart` + * (i.e.`department`, `departureDate`, `departureTime`, etc.)<br><br><br>Note that some + * properties can be combined when filtering resources, which include the following: `substringof() and/or + * resourceType`, `plan and plan/publisher and plan/name`, and `identity and identity/principalId`. + * @param expand Comma-separated list of additional properties to be included in the response. Valid values include + * `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. + * @param top The number of results to return. If null is passed, returns 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 the resources in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String filter, String expand, Integer top, Context context); + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case + * insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the 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 whether resource exists. + */ + boolean checkExistence( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion); + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case + * insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the 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 whether resource exists along with {@link Response}. + */ + Response checkExistenceWithResponse( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context); + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the 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 resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion); + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the 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 resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context); + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating 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 resource information. + */ + GenericResource createOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters); + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating 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 resource information. + */ + GenericResource createOrUpdate( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context); + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating 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 resource information. + */ + GenericResource update( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters); + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating 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 resource information. + */ + GenericResource update( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + GenericResourceInner parameters, + Context context); + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource. + */ + GenericResource get( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion); + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case + * insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the 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 a resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String apiVersion, + Context context); + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 whether resource exists. + */ + boolean checkExistenceById(String resourceId, String apiVersion); + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 whether resource exists along with {@link Response}. + */ + Response checkExistenceByIdWithResponse(String resourceId, String apiVersion, Context context); + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 deleteById(String resourceId, String apiVersion); + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 deleteById(String resourceId, String apiVersion, Context context); + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + GenericResource createOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters); + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + GenericResource createOrUpdateById( + String resourceId, String apiVersion, GenericResourceInner parameters, Context context); + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + GenericResource updateById(String resourceId, String apiVersion, GenericResourceInner parameters); + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information. + */ + GenericResource updateById(String resourceId, String apiVersion, GenericResourceInner parameters, Context context); + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource by ID. + */ + GenericResource getById(String resourceId, String apiVersion); + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the + * format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + * @param apiVersion The API version to use for the 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 a resource by ID along with {@link Response}. + */ + Response getByIdWithResponse(String resourceId, String apiVersion, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourcesMoveInfo.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourcesMoveInfo.java new file mode 100644 index 0000000000000..a15e34302d9f6 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ResourcesMoveInfo.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.resources.generated.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; + +/** Parameters of move resources. */ +@Fluent +public final class ResourcesMoveInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourcesMoveInfo.class); + + /* + * The IDs of the resources. + */ + @JsonProperty(value = "resources") + private List resources; + + /* + * The target resource group. + */ + @JsonProperty(value = "targetResourceGroup") + private String targetResourceGroup; + + /** + * Get the resources property: The IDs of the resources. + * + * @return the resources value. + */ + public List resources() { + return this.resources; + } + + /** + * Set the resources property: The IDs of the resources. + * + * @param resources the resources value to set. + * @return the ResourcesMoveInfo object itself. + */ + public ResourcesMoveInfo withResources(List resources) { + this.resources = resources; + return this; + } + + /** + * Get the targetResourceGroup property: The target resource group. + * + * @return the targetResourceGroup value. + */ + public String targetResourceGroup() { + return this.targetResourceGroup; + } + + /** + * Set the targetResourceGroup property: The target resource group. + * + * @param targetResourceGroup the targetResourceGroup value to set. + * @return the ResourcesMoveInfo object itself. + */ + public ResourcesMoveInfo withTargetResourceGroup(String targetResourceGroup) { + this.targetResourceGroup = targetResourceGroup; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/RoleDefinition.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/RoleDefinition.java new file mode 100644 index 0000000000000..21c699869b211 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/RoleDefinition.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Role definition properties. */ +@Fluent +public final class RoleDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleDefinition.class); + + /* + * The role definition ID. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The role definition name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * If this is a service role. + */ + @JsonProperty(value = "isServiceRole") + private Boolean isServiceRole; + + /* + * Role definition permissions. + */ + @JsonProperty(value = "permissions") + private List permissions; + + /* + * Role definition assignable scopes. + */ + @JsonProperty(value = "scopes") + private List scopes; + + /** + * Get the id property: The role definition ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The role definition ID. + * + * @param id the id value to set. + * @return the RoleDefinition object itself. + */ + public RoleDefinition withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The role definition name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The role definition name. + * + * @param name the name value to set. + * @return the RoleDefinition object itself. + */ + public RoleDefinition withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isServiceRole property: If this is a service role. + * + * @return the isServiceRole value. + */ + public Boolean isServiceRole() { + return this.isServiceRole; + } + + /** + * Set the isServiceRole property: If this is a service role. + * + * @param isServiceRole the isServiceRole value to set. + * @return the RoleDefinition object itself. + */ + public RoleDefinition withIsServiceRole(Boolean isServiceRole) { + this.isServiceRole = isServiceRole; + return this; + } + + /** + * Get the permissions property: Role definition permissions. + * + * @return the permissions value. + */ + public List permissions() { + return this.permissions; + } + + /** + * Set the permissions property: Role definition permissions. + * + * @param permissions the permissions value to set. + * @return the RoleDefinition object itself. + */ + public RoleDefinition withPermissions(List permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the scopes property: Role definition assignable scopes. + * + * @return the scopes value. + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes property: Role definition assignable scopes. + * + * @param scopes the scopes value to set. + * @return the RoleDefinition object itself. + */ + public RoleDefinition withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (permissions() != null) { + permissions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ScopedDeployment.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ScopedDeployment.java new file mode 100644 index 0000000000000..29ec917639e76 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ScopedDeployment.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Deployment operation parameters. */ +@Fluent +public final class ScopedDeployment { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScopedDeployment.class); + + /* + * The location to store the deployment data. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * The deployment properties. + */ + @JsonProperty(value = "properties", required = true) + private DeploymentProperties properties; + + /* + * Deployment tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the location property: The location to store the deployment data. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location to store the deployment data. + * + * @param location the location value to set. + * @return the ScopedDeployment object itself. + */ + public ScopedDeployment withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the properties property: The deployment properties. + * + * @return the properties value. + */ + public DeploymentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The deployment properties. + * + * @param properties the properties value to set. + * @return the ScopedDeployment object itself. + */ + public ScopedDeployment withProperties(DeploymentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Deployment tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Deployment tags. + * + * @param tags the tags value to set. + * @return the ScopedDeployment object itself. + */ + public ScopedDeployment withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model ScopedDeployment")); + } + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property properties in model ScopedDeployment")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ScopedDeploymentWhatIf.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ScopedDeploymentWhatIf.java new file mode 100644 index 0000000000000..780c95cae5f4b --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ScopedDeploymentWhatIf.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Deployment What-if operation parameters. */ +@Fluent +public final class ScopedDeploymentWhatIf { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScopedDeploymentWhatIf.class); + + /* + * The location to store the deployment data. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * The deployment properties. + */ + @JsonProperty(value = "properties", required = true) + private DeploymentWhatIfProperties properties; + + /** + * Get the location property: The location to store the deployment data. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location to store the deployment data. + * + * @param location the location value to set. + * @return the ScopedDeploymentWhatIf object itself. + */ + public ScopedDeploymentWhatIf withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the properties property: The deployment properties. + * + * @return the properties value. + */ + public DeploymentWhatIfProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The deployment properties. + * + * @param properties the properties value to set. + * @return the ScopedDeploymentWhatIf object itself. + */ + public ScopedDeploymentWhatIf withProperties(DeploymentWhatIfProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model ScopedDeploymentWhatIf")); + } + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model ScopedDeploymentWhatIf")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Sku.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Sku.java new file mode 100644 index 0000000000000..9201b5e48eacb --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Sku.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** SKU for the resource. */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * The SKU name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The SKU tier. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * The SKU size. + */ + @JsonProperty(value = "size") + private String size; + + /* + * The SKU family. + */ + @JsonProperty(value = "family") + private String family; + + /* + * The SKU model. + */ + @JsonProperty(value = "model") + private String model; + + /* + * The SKU capacity. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name property: The SKU name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The SKU name. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The SKU tier. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: The SKU tier. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the size property: The SKU size. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The SKU size. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: The SKU family. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: The SKU family. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the model property: The SKU model. + * + * @return the model value. + */ + public String model() { + return this.model; + } + + /** + * Set the model property: The SKU model. + * + * @param model the model value to set. + * @return the Sku object itself. + */ + public Sku withModel(String model) { + this.model = model; + return this; + } + + /** + * Get the capacity property: The SKU capacity. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The SKU capacity. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/StatusMessage.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/StatusMessage.java new file mode 100644 index 0000000000000..f1d3badb39a3f --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/StatusMessage.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.resources.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation status message object. */ +@Fluent +public final class StatusMessage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StatusMessage.class); + + /* + * Status of the deployment operation. + */ + @JsonProperty(value = "status") + private String status; + + /* + * Error Response The error reported by the operation. + */ + @JsonProperty(value = "error") + private ManagementError error; + + /** + * Get the status property: Status of the deployment operation. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: Status of the deployment operation. + * + * @param status the status value to set. + * @return the StatusMessage object itself. + */ + public StatusMessage withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error property: Error Response The error reported by the operation. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: Error Response The error reported by the operation. + * + * @param error the error value to set. + * @return the StatusMessage object itself. + */ + public StatusMessage withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagCount.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagCount.java new file mode 100644 index 0000000000000..17d7b907312e4 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagCount.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.resources.generated.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; + +/** Tag count. */ +@Fluent +public final class TagCount { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagCount.class); + + /* + * Type of count. + */ + @JsonProperty(value = "type") + private String type; + + /* + * Value of count. + */ + @JsonProperty(value = "value") + private Integer value; + + /** + * Get the type property: Type of count. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Type of count. + * + * @param type the type value to set. + * @return the TagCount object itself. + */ + public TagCount withType(String type) { + this.type = type; + return this; + } + + /** + * Get the value property: Value of count. + * + * @return the value value. + */ + public Integer value() { + return this.value; + } + + /** + * Set the value property: Value of count. + * + * @param value the value value to set. + * @return the TagCount object itself. + */ + public TagCount withValue(Integer value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagDetails.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagDetails.java new file mode 100644 index 0000000000000..6b4d229a7af79 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagDetails.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.TagDetailsInner; +import java.util.List; + +/** An immutable client-side representation of TagDetails. */ +public interface TagDetails { + /** + * Gets the id property: The tag name ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the tagName property: The tag name. + * + * @return the tagName value. + */ + String tagName(); + + /** + * Gets the count property: The total number of resources that use the resource tag. When a tag is initially created + * and has no associated resources, the value is 0. + * + * @return the count value. + */ + TagCount count(); + + /** + * Gets the values property: The list of tag values. + * + * @return the values value. + */ + List values(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.TagDetailsInner object. + * + * @return the inner object. + */ + TagDetailsInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagOperations.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagOperations.java new file mode 100644 index 0000000000000..bbb11b545f2b7 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagOperations.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.TagsResourceInner; + +/** Resource collection API of TagOperations. */ +public interface TagOperations { + /** + * This operation allows deleting a value from the list of predefined values for an existing predefined tag name. + * The value being deleted must not be in use as a tag value for the given tag name for any resource. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @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 deleteValue(String tagName, String tagValue); + + /** + * This operation allows deleting a value from the list of predefined values for an existing predefined tag name. + * The value being deleted must not be in use as a tag value for the given tag name for any resource. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteValueWithResponse(String tagName, String tagValue, Context context); + + /** + * This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag + * value can have a maximum of 256 characters. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 tag information. + */ + TagValue createOrUpdateValue(String tagName, String tagValue); + + /** + * This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag + * value can have a maximum of 256 characters. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 tag information along with {@link Response}. + */ + Response createOrUpdateValueWithResponse(String tagName, String tagValue, Context context); + + /** + * This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name + * can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which + * are reserved for Azure use: 'microsoft', 'azure', 'windows'. + * + * @param tagName The name of the tag to create. + * @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 tag details. + */ + TagDetails createOrUpdate(String tagName); + + /** + * This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name + * can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which + * are reserved for Azure use: 'microsoft', 'azure', 'windows'. + * + * @param tagName The name of the tag to create. + * @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 tag details along with {@link Response}. + */ + Response createOrUpdateWithResponse(String tagName, Context context); + + /** + * This operation allows deleting a name from the list of predefined tag names for the given subscription. The name + * being deleted must not be in use as a tag name for any resource. All predefined values for the given name must + * have already been deleted. + * + * @param tagName The name of the tag. + * @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 tagName); + + /** + * This operation allows deleting a name from the list of predefined tag names for the given subscription. The name + * being deleted must not be in use as a tag name for any resource. All predefined values for the given name must + * have already been deleted. + * + * @param tagName The name of the tag. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String tagName, Context context); + + /** + * This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and + * returns a summary of usage for each tag name and value under the given subscription. In case of a large number of + * tags, this operation may return a previously cached result. + * + * @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 list of subscription tags as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and + * returns a summary of usage for each tag name and value under the given subscription. In case of a large number of + * tags, this operation may return a previously cached result. + * + * @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 list of subscription tags as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The + * specified entity can have a maximum of 50 tags. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags API requests and responses. + * @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 wrapper resource for tags API requests and responses. + */ + TagsResource createOrUpdateAtScope(String scope, TagsResourceInner parameters); + + /** + * This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The + * specified entity can have a maximum of 50 tags. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags API requests and responses. + * @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 wrapper resource for tags API requests and responses along with {@link Response}. + */ + Response createOrUpdateAtScopeWithResponse( + String scope, TagsResourceInner parameters, Context context); + + /** + * This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. + * The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the + * entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the + * values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or + * name/value pairs. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags patch API request only. + * @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 wrapper resource for tags API requests and responses. + */ + TagsResource updateAtScope(String scope, TagsPatchResource parameters); + + /** + * This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. + * The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the + * entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the + * values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or + * name/value pairs. + * + * @param scope The resource scope. + * @param parameters Wrapper resource for tags patch API request only. + * @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 wrapper resource for tags API requests and responses along with {@link Response}. + */ + Response updateAtScopeWithResponse(String scope, TagsPatchResource parameters, Context context); + + /** + * Gets the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @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 entire set of tags on a resource or subscription. + */ + TagsResource getAtScope(String scope); + + /** + * Gets the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @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 entire set of tags on a resource or subscription along with {@link Response}. + */ + Response getAtScopeWithResponse(String scope, Context context); + + /** + * Deletes the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @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 deleteAtScope(String scope); + + /** + * Deletes the entire set of tags on a resource or subscription. + * + * @param scope The resource scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteAtScopeWithResponse(String scope, Context context); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagValue.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagValue.java new file mode 100644 index 0000000000000..81313ba483c65 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagValue.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.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.TagValueInner; + +/** An immutable client-side representation of TagValue. */ +public interface TagValue { + /** + * Gets the id property: The tag value ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the tagValue property: The tag value. + * + * @return the tagValue value. + */ + String tagValue(); + + /** + * Gets the count property: The tag value count. + * + * @return the count value. + */ + TagCount count(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.TagValueInner object. + * + * @return the inner object. + */ + TagValueInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Tags.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Tags.java new file mode 100644 index 0000000000000..597be3195f254 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/Tags.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.resources.generated.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; + +/** A dictionary of name and value pairs. */ +@Fluent +public final class Tags { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Tags.class); + + /* + * Dictionary of + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Dictionary of <string>. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Dictionary of <string>. + * + * @param tags the tags value to set. + * @return the Tags object itself. + */ + public Tags withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsListResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsListResult.java new file mode 100644 index 0000000000000..9d9c13c030ba2 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.generated.fluent.models.TagDetailsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of subscription tags. */ +@Fluent +public final class TagsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsListResult.class); + + /* + * An array of tags. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: An array of tags. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of tags. + * + * @param value the value value to set. + * @return the TagsListResult object itself. + */ + public TagsListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsPatchOperation.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsPatchOperation.java new file mode 100644 index 0000000000000..9c4850fc3f900 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsPatchOperation.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.resources.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TagsPatchOperation. */ +public final class TagsPatchOperation extends ExpandableStringEnum { + /** Static value Replace for TagsPatchOperation. */ + public static final TagsPatchOperation REPLACE = fromString("Replace"); + + /** Static value Merge for TagsPatchOperation. */ + public static final TagsPatchOperation MERGE = fromString("Merge"); + + /** Static value Delete for TagsPatchOperation. */ + public static final TagsPatchOperation DELETE = fromString("Delete"); + + /** + * Creates or finds a TagsPatchOperation from its string representation. + * + * @param name a name to look for. + * @return the corresponding TagsPatchOperation. + */ + @JsonCreator + public static TagsPatchOperation fromString(String name) { + return fromString(name, TagsPatchOperation.class); + } + + /** @return known TagsPatchOperation values. */ + public static Collection values() { + return values(TagsPatchOperation.class); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsPatchResource.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsPatchResource.java new file mode 100644 index 0000000000000..d10c531720770 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsPatchResource.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.resources.generated.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; + +/** Wrapper resource for tags patch API request only. */ +@Fluent +public final class TagsPatchResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsPatchResource.class); + + /* + * The operation type for the patch API. + */ + @JsonProperty(value = "operation") + private TagsPatchOperation operation; + + /* + * The set of tags. + */ + @JsonProperty(value = "properties") + private Tags properties; + + /** + * Get the operation property: The operation type for the patch API. + * + * @return the operation value. + */ + public TagsPatchOperation operation() { + return this.operation; + } + + /** + * Set the operation property: The operation type for the patch API. + * + * @param operation the operation value to set. + * @return the TagsPatchResource object itself. + */ + public TagsPatchResource withOperation(TagsPatchOperation operation) { + this.operation = operation; + return this; + } + + /** + * Get the properties property: The set of tags. + * + * @return the properties value. + */ + public Tags properties() { + return this.properties; + } + + /** + * Set the properties property: The set of tags. + * + * @param properties the properties value to set. + * @return the TagsPatchResource object itself. + */ + public TagsPatchResource withProperties(Tags 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/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsResource.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsResource.java new file mode 100644 index 0000000000000..1c96fa3652bc5 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TagsResource.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.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.TagsResourceInner; + +/** An immutable client-side representation of TagsResource. */ +public interface TagsResource { + /** + * 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: The set of tags. + * + * @return the properties value. + */ + Tags properties(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.TagsResourceInner object. + * + * @return the inner object. + */ + TagsResourceInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TargetResource.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TargetResource.java new file mode 100644 index 0000000000000..80772fa5ace41 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TargetResource.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.resources.generated.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; + +/** Target resource. */ +@Fluent +public final class TargetResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TargetResource.class); + + /* + * The ID of the resource. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The name of the resource. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /* + * The type of the resource. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * Get the id property: The ID of the resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ID of the resource. + * + * @param id the id value to set. + * @return the TargetResource object itself. + */ + public TargetResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the resourceName property: The name of the resource. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: The name of the resource. + * + * @param resourceName the resourceName value to set. + * @return the TargetResource object itself. + */ + public TargetResource withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Get the resourceType property: The type of the resource. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: The type of the resource. + * + * @param resourceType the resourceType value to set. + * @return the TargetResource object itself. + */ + public TargetResource withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TemplateHashResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TemplateHashResult.java new file mode 100644 index 0000000000000..5261962f31c74 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TemplateHashResult.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.resources.generated.models; + +import com.azure.resourcemanager.resources.generated.fluent.models.TemplateHashResultInner; + +/** An immutable client-side representation of TemplateHashResult. */ +public interface TemplateHashResult { + /** + * Gets the minifiedTemplate property: The minified template string. + * + * @return the minifiedTemplate value. + */ + String minifiedTemplate(); + + /** + * Gets the templateHash property: The template hash. + * + * @return the templateHash value. + */ + String templateHash(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.TemplateHashResultInner object. + * + * @return the inner object. + */ + TemplateHashResultInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TemplateLink.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TemplateLink.java new file mode 100644 index 0000000000000..2962d084ec594 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/TemplateLink.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Entity representing the reference to the template. */ +@Fluent +public final class TemplateLink { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TemplateLink.class); + + /* + * The URI of the template to deploy. Use either the uri or id property, + * but not both. + */ + @JsonProperty(value = "uri") + private String uri; + + /* + * The resource id of a Template Spec. Use either the id or uri property, + * but not both. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The relativePath property can be used to deploy a linked template at a + * location relative to the parent. If the parent template was linked with + * a TemplateSpec, this will reference an artifact in the TemplateSpec. If + * the parent was linked with a URI, the child deployment will be a + * combination of the parent and relativePath URIs + */ + @JsonProperty(value = "relativePath") + private String relativePath; + + /* + * If included, must match the ContentVersion in the template. + */ + @JsonProperty(value = "contentVersion") + private String contentVersion; + + /* + * The query string (for example, a SAS token) to be used with the + * templateLink URI. + */ + @JsonProperty(value = "queryString") + private String queryString; + + /** + * Get the uri property: The URI of the template to deploy. Use either the uri or id property, but not both. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The URI of the template to deploy. Use either the uri or id property, but not both. + * + * @param uri the uri value to set. + * @return the TemplateLink object itself. + */ + public TemplateLink withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the id property: The resource id of a Template Spec. Use either the id or uri property, but not both. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The resource id of a Template Spec. Use either the id or uri property, but not both. + * + * @param id the id value to set. + * @return the TemplateLink object itself. + */ + public TemplateLink withId(String id) { + this.id = id; + return this; + } + + /** + * Get the relativePath property: The relativePath property can be used to deploy a linked template at a location + * relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in + * the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent + * and relativePath URIs. + * + * @return the relativePath value. + */ + public String relativePath() { + return this.relativePath; + } + + /** + * Set the relativePath property: The relativePath property can be used to deploy a linked template at a location + * relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in + * the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent + * and relativePath URIs. + * + * @param relativePath the relativePath value to set. + * @return the TemplateLink object itself. + */ + public TemplateLink withRelativePath(String relativePath) { + this.relativePath = relativePath; + return this; + } + + /** + * Get the contentVersion property: If included, must match the ContentVersion in the template. + * + * @return the contentVersion value. + */ + public String contentVersion() { + return this.contentVersion; + } + + /** + * Set the contentVersion property: If included, must match the ContentVersion in the template. + * + * @param contentVersion the contentVersion value to set. + * @return the TemplateLink object itself. + */ + public TemplateLink withContentVersion(String contentVersion) { + this.contentVersion = contentVersion; + return this; + } + + /** + * Get the queryString property: The query string (for example, a SAS token) to be used with the templateLink URI. + * + * @return the queryString value. + */ + public String queryString() { + return this.queryString; + } + + /** + * Set the queryString property: The query string (for example, a SAS token) to be used with the templateLink URI. + * + * @param queryString the queryString value to set. + * @return the TemplateLink object itself. + */ + public TemplateLink withQueryString(String queryString) { + this.queryString = queryString; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfChange.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfChange.java new file mode 100644 index 0000000000000..f12f8938102c8 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfChange.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** Information about a single resource change predicted by What-If operation. */ +@Fluent +public final class WhatIfChange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WhatIfChange.class); + + /* + * Resource ID + */ + @JsonProperty(value = "resourceId", required = true) + private String resourceId; + + /* + * Type of change that will be made to the resource when the deployment is + * executed. + */ + @JsonProperty(value = "changeType", required = true) + private ChangeType changeType; + + /* + * The explanation about why the resource is unsupported by What-If. + */ + @JsonProperty(value = "unsupportedReason") + private String unsupportedReason; + + /* + * The snapshot of the resource before the deployment is executed. + */ + @JsonProperty(value = "before") + private Object before; + + /* + * The predicted snapshot of the resource after the deployment is executed. + */ + @JsonProperty(value = "after") + private Object after; + + /* + * The predicted changes to resource properties. + */ + @JsonProperty(value = "delta") + private List delta; + + /** + * Get the resourceId property: Resource ID. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Resource ID. + * + * @param resourceId the resourceId value to set. + * @return the WhatIfChange object itself. + */ + public WhatIfChange withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the changeType property: Type of change that will be made to the resource when the deployment is executed. + * + * @return the changeType value. + */ + public ChangeType changeType() { + return this.changeType; + } + + /** + * Set the changeType property: Type of change that will be made to the resource when the deployment is executed. + * + * @param changeType the changeType value to set. + * @return the WhatIfChange object itself. + */ + public WhatIfChange withChangeType(ChangeType changeType) { + this.changeType = changeType; + return this; + } + + /** + * Get the unsupportedReason property: The explanation about why the resource is unsupported by What-If. + * + * @return the unsupportedReason value. + */ + public String unsupportedReason() { + return this.unsupportedReason; + } + + /** + * Set the unsupportedReason property: The explanation about why the resource is unsupported by What-If. + * + * @param unsupportedReason the unsupportedReason value to set. + * @return the WhatIfChange object itself. + */ + public WhatIfChange withUnsupportedReason(String unsupportedReason) { + this.unsupportedReason = unsupportedReason; + return this; + } + + /** + * Get the before property: The snapshot of the resource before the deployment is executed. + * + * @return the before value. + */ + public Object before() { + return this.before; + } + + /** + * Set the before property: The snapshot of the resource before the deployment is executed. + * + * @param before the before value to set. + * @return the WhatIfChange object itself. + */ + public WhatIfChange withBefore(Object before) { + this.before = before; + return this; + } + + /** + * Get the after property: The predicted snapshot of the resource after the deployment is executed. + * + * @return the after value. + */ + public Object after() { + return this.after; + } + + /** + * Set the after property: The predicted snapshot of the resource after the deployment is executed. + * + * @param after the after value to set. + * @return the WhatIfChange object itself. + */ + public WhatIfChange withAfter(Object after) { + this.after = after; + return this; + } + + /** + * Get the delta property: The predicted changes to resource properties. + * + * @return the delta value. + */ + public List delta() { + return this.delta; + } + + /** + * Set the delta property: The predicted changes to resource properties. + * + * @param delta the delta value to set. + * @return the WhatIfChange object itself. + */ + public WhatIfChange withDelta(List delta) { + this.delta = delta; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property resourceId in model WhatIfChange")); + } + if (changeType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property changeType in model WhatIfChange")); + } + if (delta() != null) { + delta().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfOperationResult.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfOperationResult.java new file mode 100644 index 0000000000000..fdf9fba3ba3b3 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfOperationResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.resources.generated.fluent.models.WhatIfOperationResultInner; +import java.util.List; + +/** An immutable client-side representation of WhatIfOperationResult. */ +public interface WhatIfOperationResult { + /** + * Gets the status property: Status of the What-If operation. + * + * @return the status value. + */ + String status(); + + /** + * Gets the error property: Error Response Error when What-If operation fails. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the changes property: List of resource changes predicted by What-If operation. + * + * @return the changes value. + */ + List changes(); + + /** + * Gets the inner com.azure.resourcemanager.resources.generated.fluent.models.WhatIfOperationResultInner object. + * + * @return the inner object. + */ + WhatIfOperationResultInner innerModel(); +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfPropertyChange.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfPropertyChange.java new file mode 100644 index 0000000000000..9ab68f284234d --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfPropertyChange.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.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; + +/** The predicted change to the resource property. */ +@Fluent +public final class WhatIfPropertyChange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WhatIfPropertyChange.class); + + /* + * The path of the property. + */ + @JsonProperty(value = "path", required = true) + private String path; + + /* + * The type of property change. + */ + @JsonProperty(value = "propertyChangeType", required = true) + private PropertyChangeType propertyChangeType; + + /* + * The value of the property before the deployment is executed. + */ + @JsonProperty(value = "before") + private Object before; + + /* + * The value of the property after the deployment is executed. + */ + @JsonProperty(value = "after") + private Object after; + + /* + * Nested property changes. + */ + @JsonProperty(value = "children") + private List children; + + /** + * Get the path property: The path of the property. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path of the property. + * + * @param path the path value to set. + * @return the WhatIfPropertyChange object itself. + */ + public WhatIfPropertyChange withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the propertyChangeType property: The type of property change. + * + * @return the propertyChangeType value. + */ + public PropertyChangeType propertyChangeType() { + return this.propertyChangeType; + } + + /** + * Set the propertyChangeType property: The type of property change. + * + * @param propertyChangeType the propertyChangeType value to set. + * @return the WhatIfPropertyChange object itself. + */ + public WhatIfPropertyChange withPropertyChangeType(PropertyChangeType propertyChangeType) { + this.propertyChangeType = propertyChangeType; + return this; + } + + /** + * Get the before property: The value of the property before the deployment is executed. + * + * @return the before value. + */ + public Object before() { + return this.before; + } + + /** + * Set the before property: The value of the property before the deployment is executed. + * + * @param before the before value to set. + * @return the WhatIfPropertyChange object itself. + */ + public WhatIfPropertyChange withBefore(Object before) { + this.before = before; + return this; + } + + /** + * Get the after property: The value of the property after the deployment is executed. + * + * @return the after value. + */ + public Object after() { + return this.after; + } + + /** + * Set the after property: The value of the property after the deployment is executed. + * + * @param after the after value to set. + * @return the WhatIfPropertyChange object itself. + */ + public WhatIfPropertyChange withAfter(Object after) { + this.after = after; + return this; + } + + /** + * Get the children property: Nested property changes. + * + * @return the children value. + */ + public List children() { + return this.children; + } + + /** + * Set the children property: Nested property changes. + * + * @param children the children value to set. + * @return the WhatIfPropertyChange object itself. + */ + public WhatIfPropertyChange withChildren(List children) { + this.children = children; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (path() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property path in model WhatIfPropertyChange")); + } + if (propertyChangeType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property propertyChangeType in model WhatIfPropertyChange")); + } + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfResultFormat.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfResultFormat.java new file mode 100644 index 0000000000000..b13a320f1508f --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/WhatIfResultFormat.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for WhatIfResultFormat. */ +public enum WhatIfResultFormat { + /** Enum value ResourceIdOnly. */ + RESOURCE_ID_ONLY("ResourceIdOnly"), + + /** Enum value FullResourcePayloads. */ + FULL_RESOURCE_PAYLOADS("FullResourcePayloads"); + + /** The actual serialized value for a WhatIfResultFormat instance. */ + private final String value; + + WhatIfResultFormat(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a WhatIfResultFormat instance. + * + * @param value the serialized value to parse. + * @return the parsed WhatIfResultFormat object, or null if unable to parse. + */ + @JsonCreator + public static WhatIfResultFormat fromString(String value) { + WhatIfResultFormat[] items = WhatIfResultFormat.values(); + for (WhatIfResultFormat item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ZoneMapping.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ZoneMapping.java new file mode 100644 index 0000000000000..4506beb00e2bb --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/ZoneMapping.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.resources.generated.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; + +/** The ZoneMapping model. */ +@Fluent +public final class ZoneMapping { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ZoneMapping.class); + + /* + * The location of the zone mapping. + */ + @JsonProperty(value = "location") + private String location; + + /* + * The zones property. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get the location property: The location of the zone mapping. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the zone mapping. + * + * @param location the location value to set. + * @return the ZoneMapping object itself. + */ + public ZoneMapping withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the zones property: The zones property. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: The zones property. + * + * @param zones the zones value to set. + * @return the ZoneMapping object itself. + */ + public ZoneMapping withZones(List zones) { + this.zones = zones; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/package-info.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/package-info.java new file mode 100644 index 0000000000000..14abe5e913b4f --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for ResourceManagementClient. Provides operations for working with resources and + * resource groups. + */ +package com.azure.resourcemanager.resources.generated.models; diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/package-info.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/package-info.java new file mode 100644 index 0000000000000..f8ac6598c8b7e --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/com/azure/resourcemanager/resources/generated/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for ResourceManagementClient. Provides operations for working with resources and + * resource groups. + */ +package com.azure.resourcemanager.resources.generated; diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/module-info.java b/sdk/resources/azure-resourcemanager-resources-generated/src/main/java/module-info.java new file mode 100644 index 0000000000000..e8dcb7edb80c0 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/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.resources.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.resources.generated; + exports com.azure.resourcemanager.resources.generated.fluent; + exports com.azure.resourcemanager.resources.generated.fluent.models; + exports com.azure.resourcemanager.resources.generated.models; + + opens com.azure.resourcemanager.resources.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.resources.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCalculateTemplateHashSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCalculateTemplateHashSamples.java new file mode 100644 index 0000000000000..1709978a250f2 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCalculateTemplateHashSamples.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.resources.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; + +/** Samples for Deployments CalculateTemplateHash. */ +public final class DeploymentsCalculateTemplateHashSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/CalculateTemplateHash.json + */ + /** + * Sample code: Calculate template hash. + * + * @param manager Entry point to ResourceManager. + */ + public static void calculateTemplateHash(com.azure.resourcemanager.resources.generated.ResourceManager manager) + throws IOException { + manager + .deployments() + .calculateTemplateHashWithResponse( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"$schema\":\"http://schemas.management.azure.com/deploymentTemplate?api-version=2014-04-01-preview\",\"contentVersion\":\"1.0.0.0\",\"outputs\":{\"string\":{\"type\":\"string\",\"value\":\"myvalue\"}},\"parameters\":{\"string\":{\"type\":\"string\"}},\"resources\":[],\"variables\":{\"array\":[1,2,3,4],\"bool\":true,\"int\":42,\"object\":{\"object\":{\"location\":\"West" + + " US\",\"vmSize\":\"Large\"}},\"string\":\"string\"}}", + Object.class, + SerializerEncoding.JSON), + Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtManagementGroupScopeSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtManagementGroupScopeSamples.java new file mode 100644 index 0000000000000..4a6243a06fae6 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtManagementGroupScopeSamples.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.resources.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.ScopedDeployment; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments CreateOrUpdateAtManagementGroupScope. */ +public final class DeploymentsCreateOrUpdateAtManagementGroupScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentAtManagementGroup.json + */ + /** + * Sample code: Create deployment at management group scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void createDeploymentAtManagementGroupScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .createOrUpdateAtManagementGroupScope( + "my-management-group-id", + "my-deployment", + new ScopedDeployment() + .withLocation("eastus") + .withProperties( + new DeploymentProperties() + .withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtScopeSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtScopeSamples.java new file mode 100644 index 0000000000000..344e70d2fa91e --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtScopeSamples.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.resources.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.Deployment; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Deployments CreateOrUpdateAtScope. */ +public final class DeploymentsCreateOrUpdateAtScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentAtScope.json + */ + /** + * Sample code: Create deployment at a given scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void createDeploymentAtAGivenScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .createOrUpdateAtScope( + "providers/Microsoft.Management/managementGroups/my-management-group-id", + "my-deployment", + new Deployment() + .withLocation("eastus") + .withProperties( + new DeploymentProperties() + .withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)) + .withTags(mapOf("tagKey1", "tag-value-1", "tagKey2", "tag-value-2")), + 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/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtSubscriptionScopeSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtSubscriptionScopeSamples.java new file mode 100644 index 0000000000000..c7cc48b41b89e --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtSubscriptionScopeSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.Deployment; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments CreateOrUpdateAtSubscriptionScope. */ +public final class DeploymentsCreateOrUpdateAtSubscriptionScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentSubscriptionTemplateSpecsWithId.json + */ + /** + * Sample code: Create a deployment that will deploy a templateSpec with the given resourceId. + * + * @param manager Entry point to ResourceManager. + */ + public static void createADeploymentThatWillDeployATemplateSpecWithTheGivenResourceId( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .createOrUpdateAtSubscriptionScope( + "my-deployment", + new Deployment() + .withLocation("eastus") + .withProperties( + new DeploymentProperties() + .withTemplateLink( + new TemplateLink() + .withId( + "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtTenantScopeSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtTenantScopeSamples.java new file mode 100644 index 0000000000000..6d0038e020e54 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateAtTenantScopeSamples.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.ScopedDeployment; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Deployments CreateOrUpdateAtTenantScope. */ +public final class DeploymentsCreateOrUpdateAtTenantScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentAtTenant.json + */ + /** + * Sample code: Create deployment at tenant scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void createDeploymentAtTenantScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .createOrUpdateAtTenantScope( + "tenant-dep01", + new ScopedDeployment() + .withLocation("eastus") + .withProperties( + new DeploymentProperties() + .withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)) + .withTags(mapOf("tagKey1", "tag-value-1", "tagKey2", "tag-value-2")), + 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/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0d689347f3771 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsCreateOrUpdateSamples.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentProperties; +import com.azure.resourcemanager.resources.generated.models.OnErrorDeployment; +import com.azure.resourcemanager.resources.generated.models.OnErrorDeploymentType; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments CreateOrUpdate. */ +public final class DeploymentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentResourceGroup.json + */ + /** + * Sample code: Create a deployment that will deploy a template with a uri and queryString. + * + * @param manager Entry point to ResourceManager. + */ + public static void createADeploymentThatWillDeployATemplateWithAUriAndQueryString( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .define("my-deployment") + .withExistingResourceGroup("my-resource-group") + .withProperties( + new DeploymentProperties() + .withTemplateLink( + new TemplateLink() + .withUri("https://example.com/exampleTemplate.json") + .withQueryString( + "sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=xxxxxxxx0xxxxxxxxxxxxx%2bxxxxxxxxxxxxxxxxxxxx%3d")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)) + .create(); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentResourceGroupTemplateSpecsWithId.json + */ + /** + * Sample code: Create a deployment that will deploy a templateSpec with the given resourceId. + * + * @param manager Entry point to ResourceManager. + */ + public static void createADeploymentThatWillDeployATemplateSpecWithTheGivenResourceId( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .define("my-deployment") + .withExistingResourceGroup("my-resource-group") + .withProperties( + new DeploymentProperties() + .withTemplateLink( + new TemplateLink() + .withId( + "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.Resources/TemplateSpecs/TemplateSpec-Name/versions/v1")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)) + .create(); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentWithOnErrorDeploymentSpecificDeployment.json + */ + /** + * Sample code: Create a deployment that will redeploy another deployment on failure. + * + * @param manager Entry point to ResourceManager. + */ + public static void createADeploymentThatWillRedeployAnotherDeploymentOnFailure( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .define("my-deployment") + .withExistingResourceGroup("my-resource-group") + .withProperties( + new DeploymentProperties() + .withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.COMPLETE) + .withOnErrorDeployment( + new OnErrorDeployment() + .withType(OnErrorDeploymentType.SPECIFIC_DEPLOYMENT) + .withDeploymentName("name-of-deployment-to-use"))) + .create(); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutDeploymentWithOnErrorDeploymentLastSuccessful.json + */ + /** + * Sample code: Create a deployment that will redeploy the last successful deployment on failure. + * + * @param manager Entry point to ResourceManager. + */ + public static void createADeploymentThatWillRedeployTheLastSuccessfulDeploymentOnFailure( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .define("my-deployment") + .withExistingResourceGroup("my-resource-group") + .withProperties( + new DeploymentProperties() + .withTemplateLink(new TemplateLink().withUri("https://example.com/exampleTemplate.json")) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.COMPLETE) + .withOnErrorDeployment(new OnErrorDeployment().withType(OnErrorDeploymentType.LAST_SUCCESSFUL))) + .create(); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfAtManagementGroupScopeSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfAtManagementGroupScopeSamples.java new file mode 100644 index 0000000000000..f551576d9ec7f --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfAtManagementGroupScopeSamples.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.resources.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIfProperties; +import com.azure.resourcemanager.resources.generated.models.ScopedDeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments WhatIfAtManagementGroupScope. */ +public final class DeploymentsWhatIfAtManagementGroupScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PostDeploymentWhatIfOnManagementGroup.json + */ + /** + * Sample code: Predict template changes at management group scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void predictTemplateChangesAtManagementGroupScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .whatIfAtManagementGroupScope( + "myManagementGruop", + "exampleDeploymentName", + new ScopedDeploymentWhatIf() + .withLocation("eastus") + .withProperties( + new DeploymentWhatIfProperties() + .withTemplateLink(new TemplateLink()) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfAtSubscriptionScopeSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfAtSubscriptionScopeSamples.java new file mode 100644 index 0000000000000..08ab31596ab83 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfAtSubscriptionScopeSamples.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.resources.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIfProperties; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments WhatIfAtSubscriptionScope. */ +public final class DeploymentsWhatIfAtSubscriptionScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PostDeploymentWhatIfOnSubscription.json + */ + /** + * Sample code: Predict template changes at subscription scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void predictTemplateChangesAtSubscriptionScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .whatIfAtSubscriptionScope( + "my-deployment", + new DeploymentWhatIf() + .withLocation("westus") + .withProperties( + new DeploymentWhatIfProperties() + .withTemplateLink(new TemplateLink()) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfAtTenantScopeSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfAtTenantScopeSamples.java new file mode 100644 index 0000000000000..ac98f8aa3ba98 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfAtTenantScopeSamples.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.resources.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIfProperties; +import com.azure.resourcemanager.resources.generated.models.ScopedDeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments WhatIfAtTenantScope. */ +public final class DeploymentsWhatIfAtTenantScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PostDeploymentWhatIfOnTenant.json + */ + /** + * Sample code: Predict template changes at management group scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void predictTemplateChangesAtManagementGroupScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .whatIfAtTenantScope( + "exampleDeploymentName", + new ScopedDeploymentWhatIf() + .withLocation("eastus") + .withProperties( + new DeploymentWhatIfProperties() + .withTemplateLink(new TemplateLink()) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfSamples.java new file mode 100644 index 0000000000000..940d71e4cf7dd --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/DeploymentsWhatIfSamples.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.resources.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.resources.generated.models.DeploymentMode; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIf; +import com.azure.resourcemanager.resources.generated.models.DeploymentWhatIfProperties; +import com.azure.resourcemanager.resources.generated.models.TemplateLink; +import java.io.IOException; + +/** Samples for Deployments WhatIf. */ +public final class DeploymentsWhatIfSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PostDeploymentWhatIfOnResourceGroup.json + */ + /** + * Sample code: Predict template changes at resource group scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void predictTemplateChangesAtResourceGroupScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) throws IOException { + manager + .deployments() + .whatIf( + "my-resource-group", + "my-deployment", + new DeploymentWhatIf() + .withProperties( + new DeploymentWhatIfProperties() + .withTemplateLink(new TemplateLink()) + .withParameters( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withMode(DeploymentMode.INCREMENTAL)), + Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProviderResourceTypesListSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProviderResourceTypesListSamples.java new file mode 100644 index 0000000000000..a42a7a1ab24f2 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProviderResourceTypesListSamples.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.resources.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ProviderResourceTypes List. */ +public final class ProviderResourceTypesListSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetProviderResourceTypes.json + */ + /** + * Sample code: Get provider resource types. + * + * @param manager Entry point to ResourceManager. + */ + public static void getProviderResourceTypes(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.providerResourceTypes().listWithResponse("Microsoft.TestRP", null, Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersGetAtTenantScopeSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersGetAtTenantScopeSamples.java new file mode 100644 index 0000000000000..dd97ea74c41b1 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersGetAtTenantScopeSamples.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.resources.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Providers GetAtTenantScope. */ +public final class ProvidersGetAtTenantScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetNamedProviderAtTenant.json + */ + /** + * Sample code: Get a resource provider at tenant scope. + * + * @param manager Entry point to ResourceManager. + */ + public static void getAResourceProviderAtTenantScope( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.providers().getAtTenantScopeWithResponse("Microsoft.Storage", "resourceTypes/aliases", Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersGetSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersGetSamples.java new file mode 100644 index 0000000000000..b8d7c46cb6f11 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersGetSamples.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.resources.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Providers Get. */ +public final class ProvidersGetSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetProvider.json + */ + /** + * Sample code: Get provider. + * + * @param manager Entry point to ResourceManager. + */ + public static void getProvider(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.providers().getWithResponse("Microsoft.TestRP1", null, Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersListSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersListSamples.java new file mode 100644 index 0000000000000..83d3ec7c273cc --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersListSamples.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.resources.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Providers List. */ +public final class ProvidersListSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetProviders.json + */ + /** + * Sample code: Get providers. + * + * @param manager Entry point to ResourceManager. + */ + public static void getProviders(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.providers().list(null, Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersProviderPermissionsSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersProviderPermissionsSamples.java new file mode 100644 index 0000000000000..6ddd41c07f43a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ProvidersProviderPermissionsSamples.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.resources.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Providers ProviderPermissions. */ +public final class ProvidersProviderPermissionsSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetProviderPermissions.json + */ + /** + * Sample code: Get provider resource types. + * + * @param manager Entry point to ResourceManager. + */ + public static void getProviderResourceTypes(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.providers().providerPermissionsWithResponse("Microsoft.TestRP", Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ResourceGroupsCreateOrUpdateSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ResourceGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d3e9cfac53732 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ResourceGroupsCreateOrUpdateSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.generated; + +/** Samples for ResourceGroups CreateOrUpdate. */ +public final class ResourceGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/CreateResourceGroup.json + */ + /** + * Sample code: Create or update a resource group. + * + * @param manager Entry point to ResourceManager. + */ + public static void createOrUpdateAResourceGroup( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.resourceGroups().define("my-resource-group").withRegion("eastus").create(); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ResourceGroupsDeleteSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ResourceGroupsDeleteSamples.java new file mode 100644 index 0000000000000..f54aaf8cad6e0 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ResourceGroupsDeleteSamples.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.resources.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceGroups Delete. */ +public final class ResourceGroupsDeleteSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ForceDeleteVMsInResourceGroup.json + */ + /** + * Sample code: Force delete all the Virtual Machines in a resource group. + * + * @param manager Entry point to ResourceManager. + */ + public static void forceDeleteAllTheVirtualMachinesInAResourceGroup( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager.resourceGroups().delete("my-resource-group", "Microsoft.Compute/virtualMachines", Context.NONE); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ForceDeleteVMsAndVMSSInResourceGroup.json + */ + /** + * Sample code: Force delete all the Virtual Machines and Virtual Machine Scale Sets in a resource group. + * + * @param manager Entry point to ResourceManager. + */ + public static void forceDeleteAllTheVirtualMachinesAndVirtualMachineScaleSetsInAResourceGroup( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .resourceGroups() + .delete( + "my-resource-group", + "Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets", + Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ResourceGroupsExportTemplateSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ResourceGroupsExportTemplateSamples.java new file mode 100644 index 0000000000000..f812d6b184c72 --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/ResourceGroupsExportTemplateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.resources.generated.models.ExportTemplateRequest; +import java.util.Arrays; + +/** Samples for ResourceGroups ExportTemplate. */ +public final class ResourceGroupsExportTemplateSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ExportResourceGroup.json + */ + /** + * Sample code: Export a resource group. + * + * @param manager Entry point to ResourceManager. + */ + public static void exportAResourceGroup(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .resourceGroups() + .exportTemplate( + "my-resource-group", + new ExportTemplateRequest() + .withResources(Arrays.asList("*")) + .withOptions("IncludeParameterDefaultValue,IncludeComments"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ExportResourceGroupWithFiltering.json + */ + /** + * Sample code: Export a resource group with filtering. + * + * @param manager Entry point to ResourceManager. + */ + public static void exportAResourceGroupWithFiltering( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .resourceGroups() + .exportTemplate( + "my-resource-group", + new ExportTemplateRequest() + .withResources( + Arrays + .asList( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/My.RP/myResourceType/myFirstResource")) + .withOptions("SkipResourceNameParameterization"), + Context.NONE); + } +} diff --git a/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/TagOperationsCreateOrUpdateAtScopeSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/TagOperationsCreateOrUpdateAtScopeSamples.java new file mode 100644 index 0000000000000..937b9ff3bd7ac --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/TagOperationsCreateOrUpdateAtScopeSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.resources.generated.fluent.models.TagsResourceInner; +import com.azure.resourcemanager.resources.generated.models.Tags; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TagOperations CreateOrUpdateAtScope. */ +public final class TagOperationsCreateOrUpdateAtScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutTagsResource.json + */ + /** + * Sample code: Update tags on a resource. + * + * @param manager Entry point to ResourceManager. + */ + public static void updateTagsOnAResource(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .tagOperations() + .createOrUpdateAtScopeWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm", + new TagsResourceInner() + .withProperties(new Tags().withTags(mapOf("tagKey1", "tag-value-1", "tagKey2", "tag-value-2"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/PutTagsSubscription.json + */ + /** + * Sample code: Update tags on a subscription. + * + * @param manager Entry point to ResourceManager. + */ + public static void updateTagsOnASubscription( + com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .tagOperations() + .createOrUpdateAtScopeWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000", + new TagsResourceInner() + .withProperties(new Tags().withTags(mapOf("tagKey1", "tag-value-1", "tagKey2", "tag-value-2"))), + 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/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/TagOperationsGetAtScopeSamples.java b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/TagOperationsGetAtScopeSamples.java new file mode 100644 index 0000000000000..dfebaab31977a --- /dev/null +++ b/sdk/resources/azure-resourcemanager-resources-generated/src/samples/java/com/azure/resourcemanager/resources/generated/generated/TagOperationsGetAtScopeSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resources.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TagOperations GetAtScope. */ +public final class TagOperationsGetAtScopeSamples { + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetTagsResource.json + */ + /** + * Sample code: Get tags on a resource. + * + * @param manager Entry point to ResourceManager. + */ + public static void getTagsOnAResource(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .tagOperations() + .getAtScopeWithResponse( + "subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/myPRNameSpace/VM/myVm", + Context.NONE); + } + + /* + * x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/GetTagsSubscription.json + */ + /** + * Sample code: Get tags on a subscription. + * + * @param manager Entry point to ResourceManager. + */ + public static void getTagsOnASubscription(com.azure.resourcemanager.resources.generated.ResourceManager manager) { + manager + .tagOperations() + .getAtScopeWithResponse("subscriptions/00000000-0000-0000-0000-000000000000", Context.NONE); + } +} diff --git a/sdk/resources/ci.yml b/sdk/resources/ci.yml new file mode 100644 index 0000000000000..7d9df664af7ed --- /dev/null +++ b/sdk/resources/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/resources/ci.yml + - sdk/resources/azure-resourcemanager-resources-generated/ + exclude: + - sdk/resources/pom.xml + - sdk/resources/azure-resourcemanager-resources-generated/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resources/ci.yml + - sdk/resources/azure-resourcemanager-resources-generated/ + exclude: + - sdk/resources/pom.xml + - sdk/resources/azure-resourcemanager-resources-generated/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: resources + Artifacts: + - name: azure-resourcemanager-resources-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerresourcesgenerated diff --git a/sdk/resources/pom.xml b/sdk/resources/pom.xml new file mode 100644 index 0000000000000..090cf1f9ec1fb --- /dev/null +++ b/sdk/resources/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-resources-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-resources-generated + + + +