diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index ef902ccc52f49..a912d22a30055 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -337,6 +337,7 @@ com.azure.resourcemanager:azure-resourcemanager-securityinsights;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-oep;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-dnsresolver;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-mobilenetwork;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-customproviders;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 0ce586ceb6e74..4dcb489820e94 100644 --- a/pom.xml +++ b/pom.xml @@ -871,6 +871,7 @@ sdk/cosmos sdk/costmanagement sdk/customerinsights + sdk/customproviders sdk/databox sdk/databoxedge sdk/databricks diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/CHANGELOG.md b/sdk/customproviders/azure-resourcemanager-customproviders/CHANGELOG.md new file mode 100644 index 0000000000000..d21e4f002518c --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-03-02) + +- Azure Resource Manager Customproviders client library for Java. This package contains Microsoft Azure SDK for Customproviders Management SDK. Allows extension of ARM control plane with custom resource providers. Package tag package-2018-09-01-preview. 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/customproviders/azure-resourcemanager-customproviders/README.md b/sdk/customproviders/azure-resourcemanager-customproviders/README.md new file mode 100644 index 0000000000000..784e88c4379b9 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Customproviders client library for Java + +Azure Resource Manager Customproviders client library for Java. + +This package contains Microsoft Azure SDK for Customproviders Management SDK. Allows extension of ARM control plane with custom resource providers. Package tag package-2018-09-01-preview. 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-customproviders;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-customproviders + 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(); +CustomprovidersManager manager = CustomprovidersManager + .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/customproviders/azure-resourcemanager-customproviders/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/customproviders/azure-resourcemanager-customproviders/SAMPLE.md b/sdk/customproviders/azure-resourcemanager-customproviders/SAMPLE.md new file mode 100644 index 0000000000000..257d85466a6c5 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/SAMPLE.md @@ -0,0 +1,307 @@ +# Code snippets and samples + + +## Associations + +- [CreateOrUpdate](#associations_createorupdate) +- [Delete](#associations_delete) +- [Get](#associations_get) +- [ListAll](#associations_listall) + +## CustomResourceProvider + +- [CreateOrUpdate](#customresourceprovider_createorupdate) +- [Delete](#customresourceprovider_delete) +- [GetByResourceGroup](#customresourceprovider_getbyresourcegroup) +- [List](#customresourceprovider_list) +- [ListByResourceGroup](#customresourceprovider_listbyresourcegroup) +- [Update](#customresourceprovider_update) + +## Operations + +- [List](#operations_list) +### Associations_CreateOrUpdate + +```java +/** Samples for Associations CreateOrUpdate. */ +public final class AssociationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/createOrUpdateAssociation.json + */ + /** + * Sample code: Create or update an association. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void createOrUpdateAnAssociation( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager + .associations() + .define("associationName") + .withExistingScope("scope") + .withTargetResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/appRG/providers/Microsoft.Solutions/applications/applicationName") + .create(); + } +} +``` + +### Associations_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Associations Delete. */ +public final class AssociationsDeleteSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/deleteAssociation.json + */ + /** + * Sample code: Delete an association. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void deleteAnAssociation(com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.associations().delete("scope", "associationName", Context.NONE); + } +} +``` + +### Associations_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Associations Get. */ +public final class AssociationsGetSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/getAssociation.json + */ + /** + * Sample code: Get an association. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void getAnAssociation(com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.associations().getWithResponse("scope", "associationName", Context.NONE); + } +} +``` + +### Associations_ListAll + +```java +import com.azure.core.util.Context; + +/** Samples for Associations ListAll. */ +public final class AssociationsListAllSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/getAllAssociations.json + */ + /** + * Sample code: Get all associations. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void getAllAssociations(com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.associations().listAll("scope", Context.NONE); + } +} +``` + +### CustomResourceProvider_CreateOrUpdate + +```java +import com.azure.resourcemanager.customproviders.models.ActionRouting; +import com.azure.resourcemanager.customproviders.models.CustomRPActionRouteDefinition; +import com.azure.resourcemanager.customproviders.models.CustomRPResourceTypeRouteDefinition; +import com.azure.resourcemanager.customproviders.models.ResourceTypeRouting; +import java.util.Arrays; + +/** Samples for CustomResourceProvider CreateOrUpdate. */ +public final class CustomResourceProviderCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/createOrUpdateCustomRP.json + */ + /** + * Sample code: Create or update the custom resource provider. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void createOrUpdateTheCustomResourceProvider( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager + .customResourceProviders() + .define("newrp") + .withRegion("eastus") + .withExistingResourceGroup("testRG") + .withActions( + Arrays + .asList( + new CustomRPActionRouteDefinition() + .withName("TestAction") + .withEndpoint("https://mytestendpoint/") + .withRoutingType(ActionRouting.PROXY))) + .withResourceTypes( + Arrays + .asList( + new CustomRPResourceTypeRouteDefinition() + .withName("TestResource") + .withEndpoint("https://mytestendpoint2/") + .withRoutingType(ResourceTypeRouting.PROXY_CACHE))) + .create(); + } +} +``` + +### CustomResourceProvider_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for CustomResourceProvider Delete. */ +public final class CustomResourceProviderDeleteSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/deleteCustomRP.json + */ + /** + * Sample code: Delete a custom resource provider. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void deleteACustomResourceProvider( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.customResourceProviders().delete("testRG", "newrp", Context.NONE); + } +} +``` + +### CustomResourceProvider_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for CustomResourceProvider GetByResourceGroup. */ +public final class CustomResourceProviderGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/getCustomRP.json + */ + /** + * Sample code: Get a custom resource provider. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void getACustomResourceProvider( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.customResourceProviders().getByResourceGroupWithResponse("testRG", "newrp", Context.NONE); + } +} +``` + +### CustomResourceProvider_List + +```java +import com.azure.core.util.Context; + +/** Samples for CustomResourceProvider List. */ +public final class CustomResourceProviderListSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/listCustomRPsBySubscription.json + */ + /** + * Sample code: List all custom resource providers on the subscription. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void listAllCustomResourceProvidersOnTheSubscription( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.customResourceProviders().list(Context.NONE); + } +} +``` + +### CustomResourceProvider_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for CustomResourceProvider ListByResourceGroup. */ +public final class CustomResourceProviderListByResourceGroupSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/listCustomRPsByResourceGroup.json + */ + /** + * Sample code: List all custom resource providers on the resourceGroup. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void listAllCustomResourceProvidersOnTheResourceGroup( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.customResourceProviders().listByResourceGroup("testRG", Context.NONE); + } +} +``` + +### CustomResourceProvider_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.customproviders.models.CustomRPManifest; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CustomResourceProvider Update. */ +public final class CustomResourceProviderUpdateSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/updateCustomRP.json + */ + /** + * Sample code: Update a custom resource provider. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void updateACustomResourceProvider( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + CustomRPManifest resource = + manager + .customResourceProviders() + .getByResourceGroupWithResponse("testRG", "newrp", Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/operationsList.json + */ + /** + * Sample code: List the custom providers operations. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void listTheCustomProvidersOperations( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/pom.xml b/sdk/customproviders/azure-resourcemanager-customproviders/pom.xml new file mode 100644 index 0000000000000..73a2d1c2e9246 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/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-customproviders + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Customproviders Management + This package contains Microsoft Azure SDK for Customproviders Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Allows extension of ARM control plane with custom resource providers. Package tag package-2018-09-01-preview. + 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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/CustomprovidersManager.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/CustomprovidersManager.java new file mode 100644 index 0000000000000..787fcabe84721 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/CustomprovidersManager.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.customproviders; + +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.customproviders.fluent.Customproviders; +import com.azure.resourcemanager.customproviders.implementation.AssociationsImpl; +import com.azure.resourcemanager.customproviders.implementation.CustomResourceProvidersImpl; +import com.azure.resourcemanager.customproviders.implementation.CustomprovidersBuilder; +import com.azure.resourcemanager.customproviders.implementation.OperationsImpl; +import com.azure.resourcemanager.customproviders.models.Associations; +import com.azure.resourcemanager.customproviders.models.CustomResourceProviders; +import com.azure.resourcemanager.customproviders.models.Operations; +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 CustomprovidersManager. Allows extension of ARM control plane with custom resource providers. */ +public final class CustomprovidersManager { + private Operations operations; + + private CustomResourceProviders customResourceProviders; + + private Associations associations; + + private final Customproviders clientObject; + + private CustomprovidersManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new CustomprovidersBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Customproviders service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Customproviders service API instance. + */ + public static CustomprovidersManager 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 CustomprovidersManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CustomprovidersManager.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 Customproviders service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Customproviders service API instance. + */ + public CustomprovidersManager 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.customproviders") + .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 CustomprovidersManager(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 CustomResourceProviders. */ + public CustomResourceProviders customResourceProviders() { + if (this.customResourceProviders == null) { + this.customResourceProviders = + new CustomResourceProvidersImpl(clientObject.getCustomResourceProviders(), this); + } + return customResourceProviders; + } + + /** @return Resource collection API of Associations. */ + public Associations associations() { + if (this.associations == null) { + this.associations = new AssociationsImpl(clientObject.getAssociations(), this); + } + return associations; + } + + /** + * @return Wrapped service client Customproviders providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public Customproviders serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/AssociationsClient.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/AssociationsClient.java new file mode 100644 index 0000000000000..bb1aac3b9b978 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/AssociationsClient.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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.customproviders.fluent.models.AssociationInner; + +/** An instance of this class provides access to all the operations defined in AssociationsClient. */ +public interface AssociationsClient { + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 the resource definition of this association. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AssociationInner> beginCreateOrUpdate( + String scope, String associationName, AssociationInner association); + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 the resource definition of this association. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AssociationInner> beginCreateOrUpdate( + String scope, String associationName, AssociationInner association, Context context); + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource definition of this association. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AssociationInner createOrUpdate(String scope, String associationName, AssociationInner association); + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource definition of this association. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AssociationInner createOrUpdate( + String scope, String associationName, AssociationInner association, Context context); + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 scope, String associationName); + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 scope, String associationName, Context context); + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 scope, String associationName); + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 scope, String associationName, Context context); + + /** + * Get an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an association. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AssociationInner get(String scope, String associationName); + + /** + * Get an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an association along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String associationName, Context context); + + /** + * Gets all association for the given scope. + * + * @param scope The scope of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 association for the given scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAll(String scope); + + /** + * Gets all association for the given scope. + * + * @param scope The scope of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 association for the given scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAll(String scope, Context context); +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/CustomResourceProvidersClient.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/CustomResourceProvidersClient.java new file mode 100644 index 0000000000000..278e3201b4e05 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/CustomResourceProvidersClient.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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.customproviders.fluent.models.CustomRPManifestInner; +import com.azure.resourcemanager.customproviders.models.ResourceProvidersUpdate; + +/** An instance of this class provides access to all the operations defined in CustomResourceProvidersClient. */ +public interface CustomResourceProvidersClient { + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 a manifest file that defines the custom resource provider + * resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CustomRPManifestInner> beginCreateOrUpdate( + String resourceGroupName, String resourceProviderName, CustomRPManifestInner resourceProvider); + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 a manifest file that defines the custom resource provider + * resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CustomRPManifestInner> beginCreateOrUpdate( + String resourceGroupName, String resourceProviderName, CustomRPManifestInner resourceProvider, Context context); + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomRPManifestInner createOrUpdate( + String resourceGroupName, String resourceProviderName, CustomRPManifestInner resourceProvider); + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomRPManifestInner createOrUpdate( + String resourceGroupName, String resourceProviderName, CustomRPManifestInner resourceProvider, Context context); + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String resourceProviderName); + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceProviderName, Context context); + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceProviderName); + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceProviderName, Context context); + + /** + * Gets the custom resource provider manifest. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 custom resource provider manifest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomRPManifestInner getByResourceGroup(String resourceGroupName, String resourceProviderName); + + /** + * Gets the custom resource provider manifest. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 custom resource provider manifest along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceProviderName, Context context); + + /** + * Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param patchableResource The updatable fields of a custom 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 a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomRPManifestInner update( + String resourceGroupName, String resourceProviderName, ResourceProvidersUpdate patchableResource); + + /** + * Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param patchableResource The updatable fields of a custom 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 a manifest file that defines the custom resource provider resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String resourceProviderName, + ResourceProvidersUpdate patchableResource, + Context context); + + /** + * Gets all the custom resource providers within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all the custom resource providers within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all the custom resource providers within 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 custom resource providers within a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all the custom resource providers within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/Customproviders.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/Customproviders.java new file mode 100644 index 0000000000000..b97a1ab68c778 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/Customproviders.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for Customproviders class. */ +public interface Customproviders { + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the CustomResourceProvidersClient object to access its operations. + * + * @return the CustomResourceProvidersClient object. + */ + CustomResourceProvidersClient getCustomResourceProviders(); + + /** + * Gets the AssociationsClient object to access its operations. + * + * @return the AssociationsClient object. + */ + AssociationsClient getAssociations(); +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/OperationsClient.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/OperationsClient.java new file mode 100644 index 0000000000000..16402ca37acfc --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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.customproviders.fluent.models.ResourceProviderOperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * The list of operations provided by Microsoft CustomProviders. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * The list of operations provided by Microsoft CustomProviders. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/AssociationInner.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/AssociationInner.java new file mode 100644 index 0000000000000..c9062db6ef93e --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/AssociationInner.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.customproviders.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.customproviders.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource definition of this association. */ +@Fluent +public final class AssociationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AssociationInner.class); + + /* + * The properties of the association. + */ + @JsonProperty(value = "properties") + private AssociationProperties innerProperties; + + /** + * Get the innerProperties property: The properties of the association. + * + * @return the innerProperties value. + */ + private AssociationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the targetResourceId property: The REST resource instance of the target resource for this association. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceId(); + } + + /** + * Set the targetResourceId property: The REST resource instance of the target resource for this association. + * + * @param targetResourceId the targetResourceId value to set. + * @return the AssociationInner object itself. + */ + public AssociationInner withTargetResourceId(String targetResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new AssociationProperties(); + } + this.innerProperties().withTargetResourceId(targetResourceId); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the association. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/AssociationProperties.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/AssociationProperties.java new file mode 100644 index 0000000000000..5461e717248f2 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/AssociationProperties.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.customproviders.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the association. */ +@Fluent +public final class AssociationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AssociationProperties.class); + + /* + * The REST resource instance of the target resource for this association. + */ + @JsonProperty(value = "targetResourceId") + private String targetResourceId; + + /* + * The provisioning state of the association. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the targetResourceId property: The REST resource instance of the target resource for this association. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Set the targetResourceId property: The REST resource instance of the target resource for this association. + * + * @param targetResourceId the targetResourceId value to set. + * @return the AssociationProperties object itself. + */ + public AssociationProperties withTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the association. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/CustomRPManifestInner.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/CustomRPManifestInner.java new file mode 100644 index 0000000000000..388baaaef1665 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/CustomRPManifestInner.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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.customproviders.models.CustomRPActionRouteDefinition; +import com.azure.resourcemanager.customproviders.models.CustomRPResourceTypeRouteDefinition; +import com.azure.resourcemanager.customproviders.models.CustomRPValidations; +import com.azure.resourcemanager.customproviders.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A manifest file that defines the custom resource provider resources. */ +@Fluent +public final class CustomRPManifestInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomRPManifestInner.class); + + /* + * The manifest for the custom resource provider + */ + @JsonProperty(value = "properties") + private CustomRPManifestProperties innerProperties; + + /** + * Get the innerProperties property: The manifest for the custom resource provider. + * + * @return the innerProperties value. + */ + private CustomRPManifestProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public CustomRPManifestInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CustomRPManifestInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the actions property: A list of actions that the custom resource provider implements. + * + * @return the actions value. + */ + public List actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); + } + + /** + * Set the actions property: A list of actions that the custom resource provider implements. + * + * @param actions the actions value to set. + * @return the CustomRPManifestInner object itself. + */ + public CustomRPManifestInner withActions(List actions) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomRPManifestProperties(); + } + this.innerProperties().withActions(actions); + return this; + } + + /** + * Get the resourceTypes property: A list of resource types that the custom resource provider implements. + * + * @return the resourceTypes value. + */ + public List resourceTypes() { + return this.innerProperties() == null ? null : this.innerProperties().resourceTypes(); + } + + /** + * Set the resourceTypes property: A list of resource types that the custom resource provider implements. + * + * @param resourceTypes the resourceTypes value to set. + * @return the CustomRPManifestInner object itself. + */ + public CustomRPManifestInner withResourceTypes(List resourceTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomRPManifestProperties(); + } + this.innerProperties().withResourceTypes(resourceTypes); + return this; + } + + /** + * Get the validations property: A list of validations to run on the custom resource provider's requests. + * + * @return the validations value. + */ + public List validations() { + return this.innerProperties() == null ? null : this.innerProperties().validations(); + } + + /** + * Set the validations property: A list of validations to run on the custom resource provider's requests. + * + * @param validations the validations value to set. + * @return the CustomRPManifestInner object itself. + */ + public CustomRPManifestInner withValidations(List validations) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomRPManifestProperties(); + } + this.innerProperties().withValidations(validations); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource provider. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/CustomRPManifestProperties.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/CustomRPManifestProperties.java new file mode 100644 index 0000000000000..49eef638e3491 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/CustomRPManifestProperties.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.customproviders.models.CustomRPActionRouteDefinition; +import com.azure.resourcemanager.customproviders.models.CustomRPResourceTypeRouteDefinition; +import com.azure.resourcemanager.customproviders.models.CustomRPValidations; +import com.azure.resourcemanager.customproviders.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The manifest for the custom resource provider. */ +@Fluent +public final class CustomRPManifestProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomRPManifestProperties.class); + + /* + * A list of actions that the custom resource provider implements. + */ + @JsonProperty(value = "actions") + private List actions; + + /* + * A list of resource types that the custom resource provider implements. + */ + @JsonProperty(value = "resourceTypes") + private List resourceTypes; + + /* + * A list of validations to run on the custom resource provider's requests. + */ + @JsonProperty(value = "validations") + private List validations; + + /* + * The provisioning state of the resource provider. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the actions property: A list of actions that the custom resource provider implements. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: A list of actions that the custom resource provider implements. + * + * @param actions the actions value to set. + * @return the CustomRPManifestProperties object itself. + */ + public CustomRPManifestProperties withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the resourceTypes property: A list of resource types that the custom resource provider implements. + * + * @return the resourceTypes value. + */ + public List resourceTypes() { + return this.resourceTypes; + } + + /** + * Set the resourceTypes property: A list of resource types that the custom resource provider implements. + * + * @param resourceTypes the resourceTypes value to set. + * @return the CustomRPManifestProperties object itself. + */ + public CustomRPManifestProperties withResourceTypes(List resourceTypes) { + this.resourceTypes = resourceTypes; + return this; + } + + /** + * Get the validations property: A list of validations to run on the custom resource provider's requests. + * + * @return the validations value. + */ + public List validations() { + return this.validations; + } + + /** + * Set the validations property: A list of validations to run on the custom resource provider's requests. + * + * @param validations the validations value to set. + * @return the CustomRPManifestProperties object itself. + */ + public CustomRPManifestProperties withValidations(List validations) { + this.validations = validations; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource provider. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (actions() != null) { + actions().forEach(e -> e.validate()); + } + if (resourceTypes() != null) { + resourceTypes().forEach(e -> e.validate()); + } + if (validations() != null) { + validations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/ResourceProviderOperationInner.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/ResourceProviderOperationInner.java new file mode 100644 index 0000000000000..cd557f81d5fce --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/ResourceProviderOperationInner.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.customproviders.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.customproviders.models.ResourceProviderOperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Supported operations of this resource provider. */ +@Fluent +public final class ResourceProviderOperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationInner.class); + + /* + * Operation name, in format of {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private ResourceProviderOperationDisplay display; + + /** + * Get the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + public ResourceProviderOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display metadata associated with the operation. + * + * @param display the display value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withDisplay(ResourceProviderOperationDisplay 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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/package-info.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/package-info.java new file mode 100644 index 0000000000000..77cffc103e825 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/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 Customproviders. Allows extension of ARM control plane with custom + * resource providers. + */ +package com.azure.resourcemanager.customproviders.fluent.models; diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/package-info.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/package-info.java new file mode 100644 index 0000000000000..ec20594332fe7 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/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 Customproviders. Allows extension of ARM control plane with custom + * resource providers. + */ +package com.azure.resourcemanager.customproviders.fluent; diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationImpl.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationImpl.java new file mode 100644 index 0000000000000..631345393d571 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.customproviders.fluent.models.AssociationInner; +import com.azure.resourcemanager.customproviders.models.Association; +import com.azure.resourcemanager.customproviders.models.ProvisioningState; + +public final class AssociationImpl implements Association, Association.Definition, Association.Update { + private AssociationInner innerObject; + + private final com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String targetResourceId() { + return this.innerModel().targetResourceId(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public AssociationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.customproviders.CustomprovidersManager manager() { + return this.serviceManager; + } + + private String scope; + + private String associationName; + + public AssociationImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public Association create() { + this.innerObject = + serviceManager + .serviceClient() + .getAssociations() + .createOrUpdate(scope, associationName, this.innerModel(), Context.NONE); + return this; + } + + public Association create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAssociations() + .createOrUpdate(scope, associationName, this.innerModel(), context); + return this; + } + + AssociationImpl(String name, com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager) { + this.innerObject = new AssociationInner(); + this.serviceManager = serviceManager; + this.associationName = name; + } + + public AssociationImpl update() { + return this; + } + + public Association apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAssociations() + .createOrUpdate(scope, associationName, this.innerModel(), Context.NONE); + return this; + } + + public Association apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAssociations() + .createOrUpdate(scope, associationName, this.innerModel(), context); + return this; + } + + AssociationImpl( + AssociationInner innerObject, com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", + "scope"); + this.associationName = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", + "associationName"); + } + + public Association refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAssociations() + .getWithResponse(scope, associationName, Context.NONE) + .getValue(); + return this; + } + + public Association refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAssociations() + .getWithResponse(scope, associationName, context) + .getValue(); + return this; + } + + public AssociationImpl withTargetResourceId(String targetResourceId) { + this.innerModel().withTargetResourceId(targetResourceId); + return this; + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationsClientImpl.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationsClientImpl.java new file mode 100644 index 0000000000000..c4f1d5216b515 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationsClientImpl.java @@ -0,0 +1,936 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.customproviders.fluent.AssociationsClient; +import com.azure.resourcemanager.customproviders.fluent.models.AssociationInner; +import com.azure.resourcemanager.customproviders.models.AssociationsList; +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 AssociationsClient. */ +public final class AssociationsClientImpl implements AssociationsClient { + private final ClientLogger logger = new ClientLogger(AssociationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AssociationsService service; + + /** The service client containing this operation class. */ + private final CustomprovidersImpl client; + + /** + * Initializes an instance of AssociationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AssociationsClientImpl(CustomprovidersImpl client) { + this.service = + RestProxy.create(AssociationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CustomprovidersAssociations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CustomprovidersAssoc") + private interface AssociationsService { + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("associationName") String associationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AssociationInner association, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("associationName") String associationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("associationName") String associationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.CustomProviders/associations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAll( + @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> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource definition of this association along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String scope, String associationName, AssociationInner association) { + 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 (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + if (association == null) { + return Mono.error(new IllegalArgumentException("Parameter association is required and cannot be null.")); + } else { + association.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + scope, + associationName, + this.client.getApiVersion(), + association, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource definition of this association along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String scope, String associationName, AssociationInner association, 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 (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + if (association == null) { + return Mono.error(new IllegalArgumentException("Parameter association is required and cannot be null.")); + } else { + association.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + scope, + associationName, + this.client.getApiVersion(), + association, + accept, + context); + } + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 the resource definition of this association. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AssociationInner> beginCreateOrUpdateAsync( + String scope, String associationName, AssociationInner association) { + Mono>> mono = createOrUpdateWithResponseAsync(scope, associationName, association); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AssociationInner.class, + AssociationInner.class, + this.client.getContext()); + } + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 the resource definition of this association. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AssociationInner> beginCreateOrUpdateAsync( + String scope, String associationName, AssociationInner association, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(scope, associationName, association, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AssociationInner.class, AssociationInner.class, context); + } + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 the resource definition of this association. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AssociationInner> beginCreateOrUpdate( + String scope, String associationName, AssociationInner association) { + return beginCreateOrUpdateAsync(scope, associationName, association).getSyncPoller(); + } + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 the resource definition of this association. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AssociationInner> beginCreateOrUpdate( + String scope, String associationName, AssociationInner association, Context context) { + return beginCreateOrUpdateAsync(scope, associationName, association, context).getSyncPoller(); + } + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource definition of this association on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String scope, String associationName, AssociationInner association) { + return beginCreateOrUpdateAsync(scope, associationName, association) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource definition of this association on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String scope, String associationName, AssociationInner association, Context context) { + return beginCreateOrUpdateAsync(scope, associationName, association, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource definition of this association. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AssociationInner createOrUpdate(String scope, String associationName, AssociationInner association) { + return createOrUpdateAsync(scope, associationName, association).block(); + } + + /** + * Create or update an association. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @param associationName The name of the association. + * @param association The parameters required to create or update an association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource definition of this association. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AssociationInner createOrUpdate( + String scope, String associationName, AssociationInner association, Context context) { + return createOrUpdateAsync(scope, associationName, association, context).block(); + } + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 scope, String associationName) { + 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 (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + scope, + associationName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 scope, String associationName, 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 (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), scope, associationName, this.client.getApiVersion(), accept, context); + } + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 scope, String associationName) { + Mono>> mono = deleteWithResponseAsync(scope, associationName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 scope, String associationName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(scope, associationName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 scope, String associationName) { + return beginDeleteAsync(scope, associationName).getSyncPoller(); + } + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 scope, String associationName, Context context) { + return beginDeleteAsync(scope, associationName, context).getSyncPoller(); + } + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 scope, String associationName) { + return beginDeleteAsync(scope, associationName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 scope, String associationName, Context context) { + return beginDeleteAsync(scope, associationName, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 scope, String associationName) { + deleteAsync(scope, associationName).block(); + } + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 scope, String associationName, Context context) { + deleteAsync(scope, associationName, context).block(); + } + + /** + * Get an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an association along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String associationName) { + 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 (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + scope, + associationName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an association along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String associationName, 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 (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), scope, associationName, this.client.getApiVersion(), accept, context); + } + + /** + * Get an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an association on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String associationName) { + return getWithResponseAsync(scope, associationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an association. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AssociationInner get(String scope, String associationName) { + return getAsync(scope, associationName).block(); + } + + /** + * Get an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an association along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String associationName, Context context) { + return getWithResponseAsync(scope, associationName, context).block(); + } + + /** + * Gets all association for the given scope. + * + * @param scope The scope of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 association for the given scope along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllSinglePageAsync(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.listAll(this.client.getEndpoint(), scope, 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 association for the given scope. + * + * @param scope The scope of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 association for the given scope along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllSinglePageAsync(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 + .listAll(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all association for the given scope. + * + * @param scope The scope of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 association for the given scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync(String scope) { + return new PagedFlux<>(() -> listAllSinglePageAsync(scope), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Gets all association for the given scope. + * + * @param scope The scope of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 association for the given scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync(String scope, Context context) { + return new PagedFlux<>( + () -> listAllSinglePageAsync(scope, context), nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all association for the given scope. + * + * @param scope The scope of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 association for the given scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAll(String scope) { + return new PagedIterable<>(listAllAsync(scope)); + } + + /** + * Gets all association for the given scope. + * + * @param scope The scope of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 association for the given scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAll(String scope, Context context) { + return new PagedIterable<>(listAllAsync(scope, 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 associations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(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 associations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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 + .listAllNext(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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationsImpl.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationsImpl.java new file mode 100644 index 0000000000000..cd9c24e2c7f5f --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationsImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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.customproviders.fluent.AssociationsClient; +import com.azure.resourcemanager.customproviders.fluent.models.AssociationInner; +import com.azure.resourcemanager.customproviders.models.Association; +import com.azure.resourcemanager.customproviders.models.Associations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AssociationsImpl implements Associations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AssociationsImpl.class); + + private final AssociationsClient innerClient; + + private final com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager; + + public AssociationsImpl( + AssociationsClient innerClient, + com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String scope, String associationName) { + this.serviceClient().delete(scope, associationName); + } + + public void delete(String scope, String associationName, Context context) { + this.serviceClient().delete(scope, associationName, context); + } + + public Association get(String scope, String associationName) { + AssociationInner inner = this.serviceClient().get(scope, associationName); + if (inner != null) { + return new AssociationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, String associationName, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, associationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AssociationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listAll(String scope) { + PagedIterable inner = this.serviceClient().listAll(scope); + return Utils.mapPage(inner, inner1 -> new AssociationImpl(inner1, this.manager())); + } + + public PagedIterable listAll(String scope, Context context) { + PagedIterable inner = this.serviceClient().listAll(scope, context); + return Utils.mapPage(inner, inner1 -> new AssociationImpl(inner1, this.manager())); + } + + public Association getById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String associationName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", + "associationName"); + if (associationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'associations'.", id))); + } + return this.getWithResponse(scope, associationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String associationName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", + "associationName"); + if (associationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'associations'.", id))); + } + return this.getWithResponse(scope, associationName, context); + } + + public void deleteById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String associationName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", + "associationName"); + if (associationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'associations'.", id))); + } + this.delete(scope, associationName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String associationName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", + "associationName"); + if (associationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'associations'.", id))); + } + this.delete(scope, associationName, context); + } + + private AssociationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.customproviders.CustomprovidersManager manager() { + return this.serviceManager; + } + + public AssociationImpl define(String name) { + return new AssociationImpl(name, this.manager()); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomRPManifestImpl.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomRPManifestImpl.java new file mode 100644 index 0000000000000..974b01e36f26a --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomRPManifestImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.customproviders.fluent.models.CustomRPManifestInner; +import com.azure.resourcemanager.customproviders.models.CustomRPActionRouteDefinition; +import com.azure.resourcemanager.customproviders.models.CustomRPManifest; +import com.azure.resourcemanager.customproviders.models.CustomRPResourceTypeRouteDefinition; +import com.azure.resourcemanager.customproviders.models.CustomRPValidations; +import com.azure.resourcemanager.customproviders.models.ProvisioningState; +import com.azure.resourcemanager.customproviders.models.ResourceProvidersUpdate; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CustomRPManifestImpl + implements CustomRPManifest, CustomRPManifest.Definition, CustomRPManifest.Update { + private CustomRPManifestInner innerObject; + + private final com.azure.resourcemanager.customproviders.CustomprovidersManager 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 List actions() { + List inner = this.innerModel().actions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List resourceTypes() { + List inner = this.innerModel().resourceTypes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List validations() { + List inner = this.innerModel().validations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CustomRPManifestInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.customproviders.CustomprovidersManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceProviderName; + + private ResourceProvidersUpdate updatePatchableResource; + + public CustomRPManifestImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CustomRPManifest create() { + this.innerObject = + serviceManager + .serviceClient() + .getCustomResourceProviders() + .createOrUpdate(resourceGroupName, resourceProviderName, this.innerModel(), Context.NONE); + return this; + } + + public CustomRPManifest create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCustomResourceProviders() + .createOrUpdate(resourceGroupName, resourceProviderName, this.innerModel(), context); + return this; + } + + CustomRPManifestImpl(String name, com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager) { + this.innerObject = new CustomRPManifestInner(); + this.serviceManager = serviceManager; + this.resourceProviderName = name; + } + + public CustomRPManifestImpl update() { + this.updatePatchableResource = new ResourceProvidersUpdate(); + return this; + } + + public CustomRPManifest apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCustomResourceProviders() + .updateWithResponse(resourceGroupName, resourceProviderName, updatePatchableResource, Context.NONE) + .getValue(); + return this; + } + + public CustomRPManifest apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCustomResourceProviders() + .updateWithResponse(resourceGroupName, resourceProviderName, updatePatchableResource, context) + .getValue(); + return this; + } + + CustomRPManifestImpl( + CustomRPManifestInner innerObject, + com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceProviderName = Utils.getValueFromIdByName(innerObject.id(), "resourceProviders"); + } + + public CustomRPManifest refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCustomResourceProviders() + .getByResourceGroupWithResponse(resourceGroupName, resourceProviderName, Context.NONE) + .getValue(); + return this; + } + + public CustomRPManifest refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCustomResourceProviders() + .getByResourceGroupWithResponse(resourceGroupName, resourceProviderName, context) + .getValue(); + return this; + } + + public CustomRPManifestImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CustomRPManifestImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CustomRPManifestImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updatePatchableResource.withTags(tags); + return this; + } + } + + public CustomRPManifestImpl withActions(List actions) { + this.innerModel().withActions(actions); + return this; + } + + public CustomRPManifestImpl withResourceTypes(List resourceTypes) { + this.innerModel().withResourceTypes(resourceTypes); + return this; + } + + public CustomRPManifestImpl withValidations(List validations) { + this.innerModel().withValidations(validations); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomResourceProvidersClientImpl.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..b4914485d8090 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomResourceProvidersClientImpl.java @@ -0,0 +1,1502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.customproviders.fluent.CustomResourceProvidersClient; +import com.azure.resourcemanager.customproviders.fluent.models.CustomRPManifestInner; +import com.azure.resourcemanager.customproviders.models.ListByCustomRPManifest; +import com.azure.resourcemanager.customproviders.models.ResourceProvidersUpdate; +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 CustomResourceProvidersClient. */ +public final class CustomResourceProvidersClientImpl implements CustomResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(CustomResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CustomResourceProvidersService service; + + /** The service client containing this operation class. */ + private final CustomprovidersImpl client; + + /** + * Initializes an instance of CustomResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CustomResourceProvidersClientImpl(CustomprovidersImpl client) { + this.service = + RestProxy + .create(CustomResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CustomprovidersCustomResourceProviders to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CustomprovidersCusto") + private interface CustomResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders" + + "/resourceProviders/{resourceProviderName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceProviderName") String resourceProviderName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CustomRPManifestInner resourceProvider, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders" + + "/resourceProviders/{resourceProviderName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceProviderName") String resourceProviderName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders" + + "/resourceProviders/{resourceProviderName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceProviderName") String resourceProviderName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders" + + "/resourceProviders/{resourceProviderName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceProviderName") String resourceProviderName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceProvidersUpdate patchableResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders" + + "/resourceProviders") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.CustomProviders/resourceProviders") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{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> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 manifest file that defines the custom resource provider resources along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceProviderName, CustomRPManifestInner resourceProvider) { + 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 (resourceProviderName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderName is required and cannot be null.")); + } + if (resourceProvider == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProvider is required and cannot be null.")); + } else { + resourceProvider.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceProviderName, + this.client.getApiVersion(), + resourceProvider, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 manifest file that defines the custom resource provider resources along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String resourceProviderName, + CustomRPManifestInner resourceProvider, + 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 (resourceProviderName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderName is required and cannot be null.")); + } + if (resourceProvider == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProvider is required and cannot be null.")); + } else { + resourceProvider.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceProviderName, + this.client.getApiVersion(), + resourceProvider, + accept, + context); + } + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 a manifest file that defines the custom resource provider + * resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CustomRPManifestInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceProviderName, CustomRPManifestInner resourceProvider) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceProviderName, resourceProvider); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CustomRPManifestInner.class, + CustomRPManifestInner.class, + this.client.getContext()); + } + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 a manifest file that defines the custom resource provider + * resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CustomRPManifestInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String resourceProviderName, + CustomRPManifestInner resourceProvider, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceProviderName, resourceProvider, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CustomRPManifestInner.class, CustomRPManifestInner.class, context); + } + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 a manifest file that defines the custom resource provider + * resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CustomRPManifestInner> beginCreateOrUpdate( + String resourceGroupName, String resourceProviderName, CustomRPManifestInner resourceProvider) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceProviderName, resourceProvider).getSyncPoller(); + } + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 a manifest file that defines the custom resource provider + * resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CustomRPManifestInner> beginCreateOrUpdate( + String resourceGroupName, + String resourceProviderName, + CustomRPManifestInner resourceProvider, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceProviderName, resourceProvider, context) + .getSyncPoller(); + } + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 manifest file that defines the custom resource provider resources on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceProviderName, CustomRPManifestInner resourceProvider) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceProviderName, resourceProvider) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 manifest file that defines the custom resource provider resources on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String resourceProviderName, + CustomRPManifestInner resourceProvider, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceProviderName, resourceProvider, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomRPManifestInner createOrUpdate( + String resourceGroupName, String resourceProviderName, CustomRPManifestInner resourceProvider) { + return createOrUpdateAsync(resourceGroupName, resourceProviderName, resourceProvider).block(); + } + + /** + * Creates or updates the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param resourceProvider The parameters required to create or update a custom resource provider definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomRPManifestInner createOrUpdate( + String resourceGroupName, + String resourceProviderName, + CustomRPManifestInner resourceProvider, + Context context) { + return createOrUpdateAsync(resourceGroupName, resourceProviderName, resourceProvider, context).block(); + } + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String resourceProviderName) { + 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 (resourceProviderName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceProviderName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String resourceProviderName, 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 (resourceProviderName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceProviderName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String resourceProviderName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceProviderName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String resourceProviderName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, resourceProviderName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String resourceProviderName) { + return beginDeleteAsync(resourceGroupName, resourceProviderName).getSyncPoller(); + } + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceProviderName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceProviderName, context).getSyncPoller(); + } + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceProviderName) { + return beginDeleteAsync(resourceGroupName, resourceProviderName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceProviderName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceProviderName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceProviderName) { + deleteAsync(resourceGroupName, resourceProviderName).block(); + } + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceProviderName, Context context) { + deleteAsync(resourceGroupName, resourceProviderName, context).block(); + } + + /** + * Gets the custom resource provider manifest. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 custom resource provider manifest along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceProviderName) { + 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 (resourceProviderName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceProviderName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the custom resource provider manifest. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 custom resource provider manifest along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceProviderName, 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 (resourceProviderName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceProviderName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the custom resource provider manifest. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 custom resource provider manifest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String resourceProviderName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceProviderName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the custom resource provider manifest. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 custom resource provider manifest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomRPManifestInner getByResourceGroup(String resourceGroupName, String resourceProviderName) { + return getByResourceGroupAsync(resourceGroupName, resourceProviderName).block(); + } + + /** + * Gets the custom resource provider manifest. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 custom resource provider manifest along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceProviderName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceProviderName, context).block(); + } + + /** + * Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param patchableResource The updatable fields of a custom 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 a manifest file that defines the custom resource provider resources along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceProviderName, ResourceProvidersUpdate patchableResource) { + 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 (resourceProviderName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderName is required and cannot be null.")); + } + if (patchableResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter patchableResource is required and cannot be null.")); + } else { + patchableResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceProviderName, + this.client.getApiVersion(), + patchableResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param patchableResource The updatable fields of a custom 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 a manifest file that defines the custom resource provider resources along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String resourceProviderName, + ResourceProvidersUpdate patchableResource, + 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 (resourceProviderName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderName is required and cannot be null.")); + } + if (patchableResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter patchableResource is required and cannot be null.")); + } else { + patchableResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceProviderName, + this.client.getApiVersion(), + patchableResource, + accept, + context); + } + + /** + * Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param patchableResource The updatable fields of a custom 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 a manifest file that defines the custom resource provider resources on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceProviderName, ResourceProvidersUpdate patchableResource) { + return updateWithResponseAsync(resourceGroupName, resourceProviderName, patchableResource) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param patchableResource The updatable fields of a custom 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 a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomRPManifestInner update( + String resourceGroupName, String resourceProviderName, ResourceProvidersUpdate patchableResource) { + return updateAsync(resourceGroupName, resourceProviderName, patchableResource).block(); + } + + /** + * Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name of the resource provider. + * @param patchableResource The updatable fields of a custom 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 a manifest file that defines the custom resource provider resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String resourceProviderName, + ResourceProvidersUpdate patchableResource, + Context context) { + return updateWithResponseAsync(resourceGroupName, resourceProviderName, patchableResource, context).block(); + } + + /** + * Gets all the custom resource providers within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all the custom resource providers within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the custom resource providers within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the custom resource providers within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the custom resource providers within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets all the custom resource providers within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets all the custom resource providers within 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 custom resource providers within a subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all the custom resource providers within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the custom resource providers within 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 custom resource providers within a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the custom resource providers within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the custom resource providers within 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 custom resource providers within a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets all the custom resource providers within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a subscription 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 list of custom resource providers 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 custom resource providers 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 custom resource providers along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 custom resource providers along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomResourceProvidersImpl.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomResourceProvidersImpl.java new file mode 100644 index 0000000000000..b14fe85ecc0fc --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomResourceProvidersImpl.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.customproviders.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.customproviders.fluent.CustomResourceProvidersClient; +import com.azure.resourcemanager.customproviders.fluent.models.CustomRPManifestInner; +import com.azure.resourcemanager.customproviders.models.CustomRPManifest; +import com.azure.resourcemanager.customproviders.models.CustomResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CustomResourceProvidersImpl implements CustomResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomResourceProvidersImpl.class); + + private final CustomResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager; + + public CustomResourceProvidersImpl( + CustomResourceProvidersClient innerClient, + com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String resourceProviderName) { + this.serviceClient().delete(resourceGroupName, resourceProviderName); + } + + public void delete(String resourceGroupName, String resourceProviderName, Context context) { + this.serviceClient().delete(resourceGroupName, resourceProviderName, context); + } + + public CustomRPManifest getByResourceGroup(String resourceGroupName, String resourceProviderName) { + CustomRPManifestInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceProviderName); + if (inner != null) { + return new CustomRPManifestImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceProviderName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceProviderName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CustomRPManifestImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CustomRPManifestImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new CustomRPManifestImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CustomRPManifestImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new CustomRPManifestImpl(inner1, this.manager())); + } + + public CustomRPManifest 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 resourceProviderName = Utils.getValueFromIdByName(id, "resourceProviders"); + if (resourceProviderName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'resourceProviders'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceProviderName, 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 resourceProviderName = Utils.getValueFromIdByName(id, "resourceProviders"); + if (resourceProviderName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'resourceProviders'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceProviderName, 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 resourceProviderName = Utils.getValueFromIdByName(id, "resourceProviders"); + if (resourceProviderName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'resourceProviders'.", id))); + } + this.delete(resourceGroupName, resourceProviderName, 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 resourceProviderName = Utils.getValueFromIdByName(id, "resourceProviders"); + if (resourceProviderName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'resourceProviders'.", id))); + } + this.delete(resourceGroupName, resourceProviderName, context); + } + + private CustomResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.customproviders.CustomprovidersManager manager() { + return this.serviceManager; + } + + public CustomRPManifestImpl define(String name) { + return new CustomRPManifestImpl(name, this.manager()); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomprovidersBuilder.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomprovidersBuilder.java new file mode 100644 index 0000000000000..fe30239d807ae --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomprovidersBuilder.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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 CustomprovidersImpl type. */ +@ServiceClientBuilder(serviceClients = {CustomprovidersImpl.class}) +public final class CustomprovidersBuilder { + /* + * The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000) + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the CustomprovidersBuilder. + */ + public CustomprovidersBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the CustomprovidersBuilder. + */ + public CustomprovidersBuilder 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 CustomprovidersBuilder. + */ + public CustomprovidersBuilder 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 CustomprovidersBuilder. + */ + public CustomprovidersBuilder 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 CustomprovidersBuilder. + */ + public CustomprovidersBuilder 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 CustomprovidersBuilder. + */ + public CustomprovidersBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CustomprovidersImpl with the provided parameters. + * + * @return an instance of CustomprovidersImpl. + */ + public CustomprovidersImpl 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(); + } + CustomprovidersImpl client = + new CustomprovidersImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomprovidersImpl.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomprovidersImpl.java new file mode 100644 index 0000000000000..c1579712db3f9 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomprovidersImpl.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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.customproviders.fluent.AssociationsClient; +import com.azure.resourcemanager.customproviders.fluent.CustomResourceProvidersClient; +import com.azure.resourcemanager.customproviders.fluent.Customproviders; +import com.azure.resourcemanager.customproviders.fluent.OperationsClient; +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 CustomprovidersImpl type. */ +@ServiceClient(builder = CustomprovidersBuilder.class) +public final class CustomprovidersImpl implements Customproviders { + private final ClientLogger logger = new ClientLogger(CustomprovidersImpl.class); + + /** The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The CustomResourceProvidersClient object to access its operations. */ + private final CustomResourceProvidersClient customResourceProviders; + + /** + * Gets the CustomResourceProvidersClient object to access its operations. + * + * @return the CustomResourceProvidersClient object. + */ + public CustomResourceProvidersClient getCustomResourceProviders() { + return this.customResourceProviders; + } + + /** The AssociationsClient object to access its operations. */ + private final AssociationsClient associations; + + /** + * Gets the AssociationsClient object to access its operations. + * + * @return the AssociationsClient object. + */ + public AssociationsClient getAssociations() { + return this.associations; + } + + /** + * Initializes an instance of Customproviders client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + CustomprovidersImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2018-09-01-preview"; + this.operations = new OperationsClientImpl(this); + this.customResourceProviders = new CustomResourceProvidersClientImpl(this); + this.associations = new AssociationsClientImpl(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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/OperationsClientImpl.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..e6baffcf4f403 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/OperationsClientImpl.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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.customproviders.fluent.OperationsClient; +import com.azure.resourcemanager.customproviders.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.customproviders.models.ResourceProviderOperationList; +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 CustomprovidersImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(CustomprovidersImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CustomprovidersOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CustomprovidersOpera") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.CustomProviders/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); + } + + /** + * The list of operations provided by Microsoft CustomProviders. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list 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())); + } + + /** + * The list of operations provided by Microsoft CustomProviders. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list 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)); + } + + /** + * The list of operations provided by Microsoft CustomProviders. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The list of operations provided by Microsoft CustomProviders. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list 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)); + } + + /** + * The list of operations provided by Microsoft CustomProviders. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * The list of operations provided by Microsoft CustomProviders. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list 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 results of the request to list 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 results of the request to list 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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/OperationsImpl.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..494f464b1cbb0 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/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.customproviders.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.customproviders.fluent.OperationsClient; +import com.azure.resourcemanager.customproviders.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.customproviders.models.Operations; +import com.azure.resourcemanager.customproviders.models.ResourceProviderOperation; +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.customproviders.CustomprovidersManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.customproviders.CustomprovidersManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/ResourceProviderOperationImpl.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/ResourceProviderOperationImpl.java new file mode 100644 index 0000000000000..f8e32e5715f87 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/ResourceProviderOperationImpl.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.customproviders.implementation; + +import com.azure.resourcemanager.customproviders.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.customproviders.models.ResourceProviderOperation; +import com.azure.resourcemanager.customproviders.models.ResourceProviderOperationDisplay; + +public final class ResourceProviderOperationImpl implements ResourceProviderOperation { + private ResourceProviderOperationInner innerObject; + + private final com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager; + + ResourceProviderOperationImpl( + ResourceProviderOperationInner innerObject, + com.azure.resourcemanager.customproviders.CustomprovidersManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public ResourceProviderOperationDisplay display() { + return this.innerModel().display(); + } + + public ResourceProviderOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.customproviders.CustomprovidersManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/Utils.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/Utils.java new file mode 100644 index 0000000000000..5a615548ee849 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/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.customproviders.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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/package-info.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/package-info.java new file mode 100644 index 0000000000000..5fa155d328d74 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/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 Customproviders. Allows extension of ARM control plane with custom + * resource providers. + */ +package com.azure.resourcemanager.customproviders.implementation; diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ActionRouting.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ActionRouting.java new file mode 100644 index 0000000000000..b182d1ac44a39 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ActionRouting.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.customproviders.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ActionRouting. */ +public final class ActionRouting extends ExpandableStringEnum { + /** Static value Proxy for ActionRouting. */ + public static final ActionRouting PROXY = fromString("Proxy"); + + /** + * Creates or finds a ActionRouting from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionRouting. + */ + @JsonCreator + public static ActionRouting fromString(String name) { + return fromString(name, ActionRouting.class); + } + + /** @return known ActionRouting values. */ + public static Collection values() { + return values(ActionRouting.class); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Association.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Association.java new file mode 100644 index 0000000000000..2361909a7b935 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Association.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.customproviders.fluent.models.AssociationInner; + +/** An immutable client-side representation of Association. */ +public interface Association { + /** + * 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 targetResourceId property: The REST resource instance of the target resource for this association. + * + * @return the targetResourceId value. + */ + String targetResourceId(); + + /** + * Gets the provisioningState property: The provisioning state of the association. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.customproviders.fluent.models.AssociationInner object. + * + * @return the inner object. + */ + AssociationInner innerModel(); + + /** The entirety of the Association definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The Association definition stages. */ + interface DefinitionStages { + /** The first stage of the Association definition. */ + interface Blank extends WithScope { + } + /** The stage of the Association definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies scope. + * + * @param scope The scope of the association. The scope can be any valid REST resource instance. For + * example, use + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' + * for a virtual machine resource. + * @return the next definition stage. + */ + WithCreate withExistingScope(String scope); + } + /** + * The stage of the Association 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.WithTargetResourceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + Association create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Association create(Context context); + } + /** The stage of the Association definition allowing to specify targetResourceId. */ + interface WithTargetResourceId { + /** + * Specifies the targetResourceId property: The REST resource instance of the target resource for this + * association.. + * + * @param targetResourceId The REST resource instance of the target resource for this association. + * @return the next definition stage. + */ + WithCreate withTargetResourceId(String targetResourceId); + } + } + /** + * Begins update for the Association resource. + * + * @return the stage of resource update. + */ + Association.Update update(); + + /** The template for Association update. */ + interface Update extends UpdateStages.WithTargetResourceId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Association apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Association apply(Context context); + } + /** The Association update stages. */ + interface UpdateStages { + /** The stage of the Association update allowing to specify targetResourceId. */ + interface WithTargetResourceId { + /** + * Specifies the targetResourceId property: The REST resource instance of the target resource for this + * association.. + * + * @param targetResourceId The REST resource instance of the target resource for this association. + * @return the next definition stage. + */ + Update withTargetResourceId(String targetResourceId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Association refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Association refresh(Context context); +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Associations.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Associations.java new file mode 100644 index 0000000000000..2f2cb438bbeb6 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Associations.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.customproviders.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 Associations. */ +public interface Associations { + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 scope, String associationName); + + /** + * Delete an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 scope, String associationName, Context context); + + /** + * Get an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an association. + */ + Association get(String scope, String associationName); + + /** + * Get an association. + * + * @param scope The scope of the association. + * @param associationName The name of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an association along with {@link Response}. + */ + Response getWithResponse(String scope, String associationName, Context context); + + /** + * Gets all association for the given scope. + * + * @param scope The scope of the association. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 association for the given scope as paginated response with {@link PagedIterable}. + */ + PagedIterable listAll(String scope); + + /** + * Gets all association for the given scope. + * + * @param scope The scope of the association. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 association for the given scope as paginated response with {@link PagedIterable}. + */ + PagedIterable listAll(String scope, Context context); + + /** + * Get an association. + * + * @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 an association along with {@link Response}. + */ + Association getById(String id); + + /** + * Get an association. + * + * @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 an association along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an association. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an association. + * + * @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 Association resource. + * + * @param name resource name. + * @return the first stage of the new Association definition. + */ + Association.DefinitionStages.Blank define(String name); +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/AssociationsList.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/AssociationsList.java new file mode 100644 index 0000000000000..7a5e25b0d6c61 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/AssociationsList.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.customproviders.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.customproviders.fluent.models.AssociationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of associations. */ +@Fluent +public final class AssociationsList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AssociationsList.class); + + /* + * The array of associations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The array of associations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of associations. + * + * @param value the value value to set. + * @return the AssociationsList object itself. + */ + public AssociationsList 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; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the AssociationsList object itself. + */ + public AssociationsList 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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPActionRouteDefinition.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPActionRouteDefinition.java new file mode 100644 index 0000000000000..bc04fe96df1e2 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPActionRouteDefinition.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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 route definition for an action implemented by the custom resource provider. */ +@Fluent +public final class CustomRPActionRouteDefinition extends CustomRPRouteDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomRPActionRouteDefinition.class); + + /* + * The routing types that are supported for action requests. + */ + @JsonProperty(value = "routingType") + private ActionRouting routingType; + + /** + * Get the routingType property: The routing types that are supported for action requests. + * + * @return the routingType value. + */ + public ActionRouting routingType() { + return this.routingType; + } + + /** + * Set the routingType property: The routing types that are supported for action requests. + * + * @param routingType the routingType value to set. + * @return the CustomRPActionRouteDefinition object itself. + */ + public CustomRPActionRouteDefinition withRoutingType(ActionRouting routingType) { + this.routingType = routingType; + return this; + } + + /** {@inheritDoc} */ + @Override + public CustomRPActionRouteDefinition withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public CustomRPActionRouteDefinition withEndpoint(String endpoint) { + super.withEndpoint(endpoint); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPManifest.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPManifest.java new file mode 100644 index 0000000000000..d880e337f3444 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPManifest.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.customproviders.fluent.models.CustomRPManifestInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of CustomRPManifest. */ +public interface CustomRPManifest { + /** + * 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 actions property: A list of actions that the custom resource provider implements. + * + * @return the actions value. + */ + List actions(); + + /** + * Gets the resourceTypes property: A list of resource types that the custom resource provider implements. + * + * @return the resourceTypes value. + */ + List resourceTypes(); + + /** + * Gets the validations property: A list of validations to run on the custom resource provider's requests. + * + * @return the validations value. + */ + List validations(); + + /** + * Gets the provisioningState property: The provisioning state of the resource provider. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * 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.customproviders.fluent.models.CustomRPManifestInner object. + * + * @return the inner object. + */ + CustomRPManifestInner innerModel(); + + /** The entirety of the CustomRPManifest definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The CustomRPManifest definition stages. */ + interface DefinitionStages { + /** The first stage of the CustomRPManifest definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CustomRPManifest definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the CustomRPManifest definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the CustomRPManifest 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.WithActions, + DefinitionStages.WithResourceTypes, + DefinitionStages.WithValidations { + /** + * Executes the create request. + * + * @return the created resource. + */ + CustomRPManifest create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CustomRPManifest create(Context context); + } + /** The stage of the CustomRPManifest 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 CustomRPManifest definition allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: A list of actions that the custom resource provider implements.. + * + * @param actions A list of actions that the custom resource provider implements. + * @return the next definition stage. + */ + WithCreate withActions(List actions); + } + /** The stage of the CustomRPManifest definition allowing to specify resourceTypes. */ + interface WithResourceTypes { + /** + * Specifies the resourceTypes property: A list of resource types that the custom resource provider + * implements.. + * + * @param resourceTypes A list of resource types that the custom resource provider implements. + * @return the next definition stage. + */ + WithCreate withResourceTypes(List resourceTypes); + } + /** The stage of the CustomRPManifest definition allowing to specify validations. */ + interface WithValidations { + /** + * Specifies the validations property: A list of validations to run on the custom resource provider's + * requests.. + * + * @param validations A list of validations to run on the custom resource provider's requests. + * @return the next definition stage. + */ + WithCreate withValidations(List validations); + } + } + /** + * Begins update for the CustomRPManifest resource. + * + * @return the stage of resource update. + */ + CustomRPManifest.Update update(); + + /** The template for CustomRPManifest update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CustomRPManifest apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CustomRPManifest apply(Context context); + } + /** The CustomRPManifest update stages. */ + interface UpdateStages { + /** The stage of the CustomRPManifest update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CustomRPManifest refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CustomRPManifest refresh(Context context); +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPResourceTypeRouteDefinition.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPResourceTypeRouteDefinition.java new file mode 100644 index 0000000000000..df69e7f20af31 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPResourceTypeRouteDefinition.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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 route definition for a resource implemented by the custom resource provider. */ +@Fluent +public final class CustomRPResourceTypeRouteDefinition extends CustomRPRouteDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomRPResourceTypeRouteDefinition.class); + + /* + * The routing types that are supported for resource requests. + */ + @JsonProperty(value = "routingType") + private ResourceTypeRouting routingType; + + /** + * Get the routingType property: The routing types that are supported for resource requests. + * + * @return the routingType value. + */ + public ResourceTypeRouting routingType() { + return this.routingType; + } + + /** + * Set the routingType property: The routing types that are supported for resource requests. + * + * @param routingType the routingType value to set. + * @return the CustomRPResourceTypeRouteDefinition object itself. + */ + public CustomRPResourceTypeRouteDefinition withRoutingType(ResourceTypeRouting routingType) { + this.routingType = routingType; + return this; + } + + /** {@inheritDoc} */ + @Override + public CustomRPResourceTypeRouteDefinition withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public CustomRPResourceTypeRouteDefinition withEndpoint(String endpoint) { + super.withEndpoint(endpoint); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPRouteDefinition.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPRouteDefinition.java new file mode 100644 index 0000000000000..699c7c67c53be --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPRouteDefinition.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.customproviders.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; + +/** + * A route definition that defines an action or resource that can be interacted with through the custom resource + * provider. + */ +@Fluent +public class CustomRPRouteDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomRPRouteDefinition.class); + + /* + * The name of the route definition. This becomes the name for the ARM + * extension (e.g. + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}') + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The route definition endpoint URI that the custom resource provider will + * proxy requests to. This can be in the form of a flat URI (e.g. + * 'https://testendpoint/') or can specify to route via a path (e.g. + * 'https://testendpoint/{requestPath}') + */ + @JsonProperty(value = "endpoint", required = true) + private String endpoint; + + /** + * Get the name property: The name of the route definition. This becomes the name for the ARM extension (e.g. + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}'). + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the route definition. This becomes the name for the ARM extension (e.g. + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}'). + * + * @param name the name value to set. + * @return the CustomRPRouteDefinition object itself. + */ + public CustomRPRouteDefinition withName(String name) { + this.name = name; + return this; + } + + /** + * Get the endpoint property: The route definition endpoint URI that the custom resource provider will proxy + * requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or can specify to route via a + * path (e.g. 'https://testendpoint/{requestPath}'). + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint property: The route definition endpoint URI that the custom resource provider will proxy + * requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or can specify to route via a + * path (e.g. 'https://testendpoint/{requestPath}'). + * + * @param endpoint the endpoint value to set. + * @return the CustomRPRouteDefinition object itself. + */ + public CustomRPRouteDefinition withEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model CustomRPRouteDefinition")); + } + if (endpoint() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property endpoint in model CustomRPRouteDefinition")); + } + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPValidations.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPValidations.java new file mode 100644 index 0000000000000..85c4a9fe671d9 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPValidations.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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; + +/** A validation to apply on custom resource provider requests. */ +@Fluent +public final class CustomRPValidations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomRPValidations.class); + + /* + * The type of validation to run against a matching request. + */ + @JsonProperty(value = "validationType") + private ValidationType validationType; + + /* + * A link to the validation specification. The specification must be hosted + * on raw.githubusercontent.com. + */ + @JsonProperty(value = "specification", required = true) + private String specification; + + /** + * Get the validationType property: The type of validation to run against a matching request. + * + * @return the validationType value. + */ + public ValidationType validationType() { + return this.validationType; + } + + /** + * Set the validationType property: The type of validation to run against a matching request. + * + * @param validationType the validationType value to set. + * @return the CustomRPValidations object itself. + */ + public CustomRPValidations withValidationType(ValidationType validationType) { + this.validationType = validationType; + return this; + } + + /** + * Get the specification property: A link to the validation specification. The specification must be hosted on + * raw.githubusercontent.com. + * + * @return the specification value. + */ + public String specification() { + return this.specification; + } + + /** + * Set the specification property: A link to the validation specification. The specification must be hosted on + * raw.githubusercontent.com. + * + * @param specification the specification value to set. + * @return the CustomRPValidations object itself. + */ + public CustomRPValidations withSpecification(String specification) { + this.specification = specification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (specification() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property specification in model CustomRPValidations")); + } + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomResourceProviders.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomResourceProviders.java new file mode 100644 index 0000000000000..8fb70527456b1 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomResourceProviders.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.customproviders.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 CustomResourceProviders. */ +public interface CustomResourceProviders { + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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. + */ + void deleteByResourceGroup(String resourceGroupName, String resourceProviderName); + + /** + * Deletes the custom resource provider. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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. + */ + void delete(String resourceGroupName, String resourceProviderName, Context context); + + /** + * Gets the custom resource provider manifest. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 custom resource provider manifest. + */ + CustomRPManifest getByResourceGroup(String resourceGroupName, String resourceProviderName); + + /** + * Gets the custom resource provider manifest. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderName The name 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 custom resource provider manifest along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceProviderName, Context context); + + /** + * Gets all the custom resource providers within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all the custom resource providers within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all the custom resource providers within 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 custom resource providers within a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets all the custom resource providers within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the custom resource providers within a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the custom resource provider manifest. + * + * @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 the custom resource provider manifest along with {@link Response}. + */ + CustomRPManifest getById(String id); + + /** + * Gets the custom resource provider manifest. + * + * @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 the custom resource provider manifest along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the custom resource provider. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the custom resource provider. + * + * @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 CustomRPManifest resource. + * + * @param name resource name. + * @return the first stage of the new CustomRPManifest definition. + */ + CustomRPManifest.DefinitionStages.Blank define(String name); +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ListByCustomRPManifest.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ListByCustomRPManifest.java new file mode 100644 index 0000000000000..c0cab3755f601 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ListByCustomRPManifest.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.customproviders.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.customproviders.fluent.models.CustomRPManifestInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of custom resource providers. */ +@Fluent +public final class ListByCustomRPManifest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListByCustomRPManifest.class); + + /* + * The array of custom resource provider manifests. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The array of custom resource provider manifests. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of custom resource provider manifests. + * + * @param value the value value to set. + * @return the ListByCustomRPManifest object itself. + */ + public ListByCustomRPManifest 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; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ListByCustomRPManifest object itself. + */ + public ListByCustomRPManifest 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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Operations.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Operations.java new file mode 100644 index 0000000000000..debe92fe0e952 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * The list of operations provided by Microsoft CustomProviders. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * The list of operations provided by Microsoft CustomProviders. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ProvisioningState.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ProvisioningState.java new file mode 100644 index 0000000000000..c159c0e82c366 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ProvisioningState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.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 Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Running for ProvisioningState. */ + public static final ProvisioningState RUNNING = fromString("Running"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * 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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperation.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperation.java new file mode 100644 index 0000000000000..13ced661bd7c5 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperation.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.customproviders.models; + +import com.azure.resourcemanager.customproviders.fluent.models.ResourceProviderOperationInner; + +/** An immutable client-side representation of ResourceProviderOperation. */ +public interface ResourceProviderOperation { + /** + * Gets the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + ResourceProviderOperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.customproviders.fluent.models.ResourceProviderOperationInner object. + * + * @return the inner object. + */ + ResourceProviderOperationInner innerModel(); +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperationDisplay.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperationDisplay.java new file mode 100644 index 0000000000000..055ff20327b4b --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperationDisplay.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.customproviders.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; + +/** Display metadata associated with the operation. */ +@Fluent +public final class ResourceProviderOperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationDisplay.class); + + /* + * Resource provider: Microsoft Custom Providers. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of this operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Resource provider: Microsoft Custom Providers. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Resource provider: Microsoft Custom Providers. + * + * @param provider the provider value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed. + * + * @param resource the resource value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Type of operation: get, read, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Type of operation: get, read, delete, etc. + * + * @param operation the operation value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of this operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of this operation. + * + * @param description the description value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay 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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperationList.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperationList.java new file mode 100644 index 0000000000000..563d10acf7ba2 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperationList.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.customproviders.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.customproviders.fluent.models.ResourceProviderOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the request to list operations. */ +@Fluent +public final class ResourceProviderOperationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationList.class); + + /* + * List of operations supported by this resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of operations supported by this resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by this resource provider. + * + * @param value the value value to set. + * @return the ResourceProviderOperationList object itself. + */ + public ResourceProviderOperationList 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; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ResourceProviderOperationList object itself. + */ + public ResourceProviderOperationList 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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProvidersUpdate.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProvidersUpdate.java new file mode 100644 index 0000000000000..b74dd35a8918a --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProvidersUpdate.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.customproviders.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; + +/** custom resource provider update information. */ +@Fluent +public final class ResourceProvidersUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersUpdate.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ResourceProvidersUpdate object itself. + */ + public ResourceProvidersUpdate 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/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceTypeRouting.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceTypeRouting.java new file mode 100644 index 0000000000000..48e2fc8b89556 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceTypeRouting.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.customproviders.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceTypeRouting. */ +public final class ResourceTypeRouting extends ExpandableStringEnum { + /** Static value Proxy for ResourceTypeRouting. */ + public static final ResourceTypeRouting PROXY = fromString("Proxy"); + + /** Static value Proxy,Cache for ResourceTypeRouting. */ + public static final ResourceTypeRouting PROXY_CACHE = fromString("Proxy,Cache"); + + /** + * Creates or finds a ResourceTypeRouting from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceTypeRouting. + */ + @JsonCreator + public static ResourceTypeRouting fromString(String name) { + return fromString(name, ResourceTypeRouting.class); + } + + /** @return known ResourceTypeRouting values. */ + public static Collection values() { + return values(ResourceTypeRouting.class); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ValidationType.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ValidationType.java new file mode 100644 index 0000000000000..d3227da7fb3a8 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ValidationType.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.customproviders.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ValidationType. */ +public final class ValidationType extends ExpandableStringEnum { + /** Static value Swagger for ValidationType. */ + public static final ValidationType SWAGGER = fromString("Swagger"); + + /** + * Creates or finds a ValidationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ValidationType. + */ + @JsonCreator + public static ValidationType fromString(String name) { + return fromString(name, ValidationType.class); + } + + /** @return known ValidationType values. */ + public static Collection values() { + return values(ValidationType.class); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/package-info.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/package-info.java new file mode 100644 index 0000000000000..58b58ed3d7b86 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/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 Customproviders. Allows extension of ARM control plane with custom resource + * providers. + */ +package com.azure.resourcemanager.customproviders.models; diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/package-info.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/package-info.java new file mode 100644 index 0000000000000..872719a62897e --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/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 Customproviders. Allows extension of ARM control plane with custom resource + * providers. + */ +package com.azure.resourcemanager.customproviders; diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/module-info.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/module-info.java new file mode 100644 index 0000000000000..88a24a030c0c7 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/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.customproviders { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.customproviders; + exports com.azure.resourcemanager.customproviders.fluent; + exports com.azure.resourcemanager.customproviders.fluent.models; + exports com.azure.resourcemanager.customproviders.models; + + opens com.azure.resourcemanager.customproviders.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.customproviders.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsCreateOrUpdateSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..45d7d57223cf9 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsCreateOrUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.generated; + +/** Samples for Associations CreateOrUpdate. */ +public final class AssociationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/createOrUpdateAssociation.json + */ + /** + * Sample code: Create or update an association. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void createOrUpdateAnAssociation( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager + .associations() + .define("associationName") + .withExistingScope("scope") + .withTargetResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/appRG/providers/Microsoft.Solutions/applications/applicationName") + .create(); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsDeleteSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsDeleteSamples.java new file mode 100644 index 0000000000000..53184dc749435 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsDeleteSamples.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.customproviders.generated; + +import com.azure.core.util.Context; + +/** Samples for Associations Delete. */ +public final class AssociationsDeleteSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/deleteAssociation.json + */ + /** + * Sample code: Delete an association. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void deleteAnAssociation(com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.associations().delete("scope", "associationName", Context.NONE); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsGetSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsGetSamples.java new file mode 100644 index 0000000000000..92d4ec42fb894 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsGetSamples.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.customproviders.generated; + +import com.azure.core.util.Context; + +/** Samples for Associations Get. */ +public final class AssociationsGetSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/getAssociation.json + */ + /** + * Sample code: Get an association. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void getAnAssociation(com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.associations().getWithResponse("scope", "associationName", Context.NONE); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsListAllSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsListAllSamples.java new file mode 100644 index 0000000000000..94fb72e2d2fa4 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/AssociationsListAllSamples.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.customproviders.generated; + +import com.azure.core.util.Context; + +/** Samples for Associations ListAll. */ +public final class AssociationsListAllSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/getAllAssociations.json + */ + /** + * Sample code: Get all associations. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void getAllAssociations(com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.associations().listAll("scope", Context.NONE); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderCreateOrUpdateSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8ee6c07583ec1 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderCreateOrUpdateSamples.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.customproviders.generated; + +import com.azure.resourcemanager.customproviders.models.ActionRouting; +import com.azure.resourcemanager.customproviders.models.CustomRPActionRouteDefinition; +import com.azure.resourcemanager.customproviders.models.CustomRPResourceTypeRouteDefinition; +import com.azure.resourcemanager.customproviders.models.ResourceTypeRouting; +import java.util.Arrays; + +/** Samples for CustomResourceProvider CreateOrUpdate. */ +public final class CustomResourceProviderCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/createOrUpdateCustomRP.json + */ + /** + * Sample code: Create or update the custom resource provider. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void createOrUpdateTheCustomResourceProvider( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager + .customResourceProviders() + .define("newrp") + .withRegion("eastus") + .withExistingResourceGroup("testRG") + .withActions( + Arrays + .asList( + new CustomRPActionRouteDefinition() + .withName("TestAction") + .withEndpoint("https://mytestendpoint/") + .withRoutingType(ActionRouting.PROXY))) + .withResourceTypes( + Arrays + .asList( + new CustomRPResourceTypeRouteDefinition() + .withName("TestResource") + .withEndpoint("https://mytestendpoint2/") + .withRoutingType(ResourceTypeRouting.PROXY_CACHE))) + .create(); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderDeleteSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderDeleteSamples.java new file mode 100644 index 0000000000000..1ea6c62c1da56 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderDeleteSamples.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.customproviders.generated; + +import com.azure.core.util.Context; + +/** Samples for CustomResourceProvider Delete. */ +public final class CustomResourceProviderDeleteSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/deleteCustomRP.json + */ + /** + * Sample code: Delete a custom resource provider. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void deleteACustomResourceProvider( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.customResourceProviders().delete("testRG", "newrp", Context.NONE); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderGetByResourceGroupSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..708b14c8a5620 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderGetByResourceGroupSamples.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.customproviders.generated; + +import com.azure.core.util.Context; + +/** Samples for CustomResourceProvider GetByResourceGroup. */ +public final class CustomResourceProviderGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/getCustomRP.json + */ + /** + * Sample code: Get a custom resource provider. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void getACustomResourceProvider( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.customResourceProviders().getByResourceGroupWithResponse("testRG", "newrp", Context.NONE); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderListByResourceGroupSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderListByResourceGroupSamples.java new file mode 100644 index 0000000000000..5869696cb6d30 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderListByResourceGroupSamples.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.customproviders.generated; + +import com.azure.core.util.Context; + +/** Samples for CustomResourceProvider ListByResourceGroup. */ +public final class CustomResourceProviderListByResourceGroupSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/listCustomRPsByResourceGroup.json + */ + /** + * Sample code: List all custom resource providers on the resourceGroup. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void listAllCustomResourceProvidersOnTheResourceGroup( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.customResourceProviders().listByResourceGroup("testRG", Context.NONE); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderListSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderListSamples.java new file mode 100644 index 0000000000000..024f24ed494b0 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderListSamples.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.customproviders.generated; + +import com.azure.core.util.Context; + +/** Samples for CustomResourceProvider List. */ +public final class CustomResourceProviderListSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/listCustomRPsBySubscription.json + */ + /** + * Sample code: List all custom resource providers on the subscription. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void listAllCustomResourceProvidersOnTheSubscription( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.customResourceProviders().list(Context.NONE); + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderUpdateSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderUpdateSamples.java new file mode 100644 index 0000000000000..cc8b97c6fb67e --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/CustomResourceProviderUpdateSamples.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.customproviders.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.customproviders.models.CustomRPManifest; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CustomResourceProvider Update. */ +public final class CustomResourceProviderUpdateSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/updateCustomRP.json + */ + /** + * Sample code: Update a custom resource provider. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void updateACustomResourceProvider( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + CustomRPManifest resource = + manager + .customResourceProviders() + .getByResourceGroupWithResponse("testRG", "newrp", Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/OperationsListSamples.java b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..b28a9d1b790f3 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/samples/java/com/azure/resourcemanager/customproviders/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/customproviders/resource-manager/Microsoft.CustomProviders/preview/2018-09-01-preview/examples/operationsList.json + */ + /** + * Sample code: List the custom providers operations. + * + * @param manager Entry point to CustomprovidersManager. + */ + public static void listTheCustomProvidersOperations( + com.azure.resourcemanager.customproviders.CustomprovidersManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/customproviders/ci.yml b/sdk/customproviders/ci.yml new file mode 100644 index 0000000000000..d722f42716e43 --- /dev/null +++ b/sdk/customproviders/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/customproviders/ci.yml + - sdk/customproviders/azure-resourcemanager-customproviders/ + exclude: + - sdk/customproviders/pom.xml + - sdk/customproviders/azure-resourcemanager-customproviders/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/customproviders/ci.yml + - sdk/customproviders/azure-resourcemanager-customproviders/ + exclude: + - sdk/customproviders/pom.xml + - sdk/customproviders/azure-resourcemanager-customproviders/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: customproviders + Artifacts: + - name: azure-resourcemanager-customproviders + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercustomproviders diff --git a/sdk/customproviders/pom.xml b/sdk/customproviders/pom.xml new file mode 100644 index 0000000000000..9b4886a4c5344 --- /dev/null +++ b/sdk/customproviders/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-customproviders-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-customproviders + + + +