From 7250f3ba409fdd4b27f2a13ec82a25e1d82eec0b Mon Sep 17 00:00:00 2001 From: SDKAuto <sdkautomation@microsoft.com> Date: Mon, 14 Dec 2020 01:18:19 +0000 Subject: [PATCH] CodeGen from PR 11940 in Azure/azure-rest-api-specs add customproviders track2 version (#11940) --- eng/versioning/external_dependencies.txt | 1 + eng/versioning/version_client.txt | 43 +- eng/versioning/version_data.txt | 2 +- pom.xml | 12 +- .../CHANGELOG.md | 5 + .../README.md | 84 + .../pom.xml | 62 + .../CustomprovidersManager.java | 225 +++ .../fluent/AssociationsClient.java | 190 +++ .../fluent/CustomResourceProvidersClient.java | 242 +++ .../fluent/Customproviders.java | 67 + .../fluent/OperationsClient.java | 36 + .../fluent/models/AssociationInner.java | 69 + .../fluent/models/CustomRPManifestInner.java | 149 ++ .../ResourceProviderOperationInner.java | 80 + .../fluent/models/package-info.java | 9 + .../customproviders/fluent/package-info.java | 9 + .../implementation/AssociationImpl.java | 49 + .../AssociationsClientImpl.java | 927 +++++++++++ .../implementation/AssociationsImpl.java | 97 ++ .../implementation/CustomRPManifestImpl.java | 224 +++ .../CustomResourceProvidersClientImpl.java | 1478 +++++++++++++++++ .../CustomResourceProvidersImpl.java | 180 ++ .../CustomprovidersBuilder.java | 147 ++ .../implementation/CustomprovidersImpl.java | 322 ++++ .../implementation/OperationsClientImpl.java | 270 +++ .../implementation/OperationsImpl.java | 46 + .../ResourceProviderOperationImpl.java | 38 + .../customproviders/implementation/Utils.java | 31 + .../implementation/package-info.java | 9 + .../customproviders/models/ActionRouting.java | 31 + .../customproviders/models/Association.java | 52 + .../customproviders/models/Associations.java | 115 ++ .../models/AssociationsList.java | 81 + .../models/CustomRPActionRouteDefinition.java | 66 + .../models/CustomRPManifest.java | 257 +++ .../CustomRPResourceTypeRouteDefinition.java | 66 + .../models/CustomRPRouteDefinition.java | 101 ++ .../models/CustomRPValidations.java | 85 + .../models/CustomResourceProviders.java | 156 ++ .../models/ListByCustomRPManifest.java | 81 + .../customproviders/models/Operations.java | 31 + .../models/ProvisioningState.java | 43 + .../models/ResourceProviderOperation.java | 31 + .../ResourceProviderOperationDisplay.java | 128 ++ .../models/ResourceProviderOperationList.java | 81 + .../models/ResourceProvidersUpdate.java | 51 + .../models/ResourceTypeRouting.java | 34 + .../models/ValidationType.java | 31 + .../customproviders/models/package-info.java | 9 + .../customproviders/package-info.java | 9 + .../src/main/java/module-info.java | 19 + sdk/customproviders/ci.yml | 31 + sdk/customproviders/pom.xml | 14 + 54 files changed, 6680 insertions(+), 26 deletions(-) create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/CHANGELOG.md create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/README.md create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/pom.xml create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/CustomprovidersManager.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/AssociationsClient.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/CustomResourceProvidersClient.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/Customproviders.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/OperationsClient.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/AssociationInner.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/CustomRPManifestInner.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/ResourceProviderOperationInner.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/package-info.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/package-info.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationImpl.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationsClientImpl.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationsImpl.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomRPManifestImpl.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomResourceProvidersClientImpl.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomResourceProvidersImpl.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomprovidersBuilder.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomprovidersImpl.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/OperationsClientImpl.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/OperationsImpl.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/ResourceProviderOperationImpl.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/Utils.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/package-info.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ActionRouting.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Association.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Associations.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/AssociationsList.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPActionRouteDefinition.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPManifest.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPResourceTypeRouteDefinition.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPRouteDefinition.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomRPValidations.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomResourceProviders.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ListByCustomRPManifest.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Operations.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ProvisioningState.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperation.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperationDisplay.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProviderOperationList.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProvidersUpdate.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceTypeRouting.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ValidationType.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/package-info.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/package-info.java create mode 100644 sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/module-info.java create mode 100644 sdk/customproviders/ci.yml create mode 100644 sdk/customproviders/pom.xml diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 62906a566feea..464bc9b7cf1a7 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -110,6 +110,7 @@ org.springframework.kafka:spring-kafka;2.5.7.RELEASE org.springframework.security:spring-security-config;5.3.5.RELEASE org.springframework.security:spring-security-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-client;5.3.5.RELEASE +org.springframework.security:spring-security-oauth2-resource-server;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-jose;5.3.5.RELEASE org.springframework.security:spring-security-web;5.3.5.RELEASE diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fa2e6238ee364..a3fde8b5cc3d5 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -40,17 +40,22 @@ com.azure:azure-ai-anomalydetector;3.0.0-beta.1;3.0.0-beta.2 com.azure:azure-ai-formrecognizer;3.0.3;3.1.0-beta.2 com.azure:azure-ai-metricsadvisor;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-ai-textanalytics;5.0.1;5.1.0-beta.4 +com.azure:azure-analytics-synapse-accesscontrol;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-artifacts;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-spark;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-managedprivateendpoints;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-analytics-synapse-monitoring;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-communication-chat;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-common;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-administration;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-sms;1.0.0-beta.3;1.0.0-beta.4 -com.azure:azure-core;1.10.0;1.11.0 -com.azure:azure-core-amqp;1.6.0;1.7.0-beta.3 +com.azure:azure-core;1.11.0;1.12.0-beta.1 +com.azure:azure-core-amqp;2.0.0;2.1.0-beta.1 com.azure:azure-core-amqp-experimental;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-experimental;1.0.0-beta.8;1.0.0-beta.9 com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-core-http-netty;1.6.3;1.7.0 -com.azure:azure-core-http-okhttp;1.3.3;1.4.0 +com.azure:azure-core-http-netty;1.7.0;1.8.0-beta.1 +com.azure:azure-core-http-okhttp;1.4.0;1.5.0-beta.1 com.azure:azure-core-management;1.0.0;1.1.0-beta.1 com.azure:azure-core-serializer-avro-apache;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-core-serializer-avro-jackson;1.0.0-beta.1;1.0.0-beta.2 @@ -58,7 +63,7 @@ com.azure:azure-core-serializer-json-gson;1.0.3;1.1.0-beta.1 com.azure:azure-core-serializer-json-jackson;1.1.0;1.2.0-beta.1 com.azure:azure-core-test;1.5.1;1.6.0-beta.1 com.azure:azure-core-tracing-opentelemetry;1.0.0-beta.6;1.0.0-beta.7 -com.azure:azure-cosmos;4.8.0;4.9.0-beta.1 +com.azure:azure-cosmos;4.9.0;4.10.0-beta.1 com.azure:azure-cosmos-benchmark;4.0.1-beta.1;4.0.1-beta.1 com.azure:azure-cosmos-dotnet-benchmark;4.0.1-beta.1;4.0.1-beta.1 com.azure:azure-cosmos-encryption;1.0.0-beta.1;1.0.0-beta.1 @@ -68,12 +73,12 @@ com.azure:azure-data-schemaregistry-avro;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-data-tables;12.0.0-beta.3;12.0.0-beta.4 com.azure:azure-digitaltwins-core;1.0.1;1.1.0-beta.1 com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-identity;1.2.0;1.3.0-beta.1 +com.azure:azure-identity;1.2.0;1.2.1 com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventgrid;2.0.0-beta.3;2.0.0-beta.4 com.azure:azure-messaging-eventhubs;5.3.1;5.4.0-beta.2 com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.3.1;1.4.0-beta.2 -com.azure:azure-messaging-servicebus;7.0.0-beta.7;7.0.0-beta.8 +com.azure:azure-messaging-servicebus;7.0.0;7.1.0-beta.1 com.azure:azure-messaging-servicebus-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track2-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-search-documents;11.1.2;11.2.0-beta.4 @@ -84,19 +89,19 @@ com.azure:azure-security-keyvault-jca;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-security-keyvault-keys;4.2.3;4.3.0-beta.4 com.azure:azure-security-keyvault-secrets;4.2.3;4.3.0-beta.3 com.azure:azure-sdk-template;1.2.1-beta.2;1.2.1-beta.16 -com.azure:azure-spring-data-cosmos;3.1.0;3.2.0-beta.1 +com.azure:azure-spring-data-cosmos;3.2.0;3.3.0-beta.1 com.azure:azure-spring-data-cosmos-test;3.0.0-beta.1;3.0.0-beta.1 -com.azure:azure-storage-blob;12.9.0;12.10.0-beta.1 -com.azure:azure-storage-blob-batch;12.7.0;12.8.0-beta.1 +com.azure:azure-storage-blob;12.9.0;12.10.0-beta.2 +com.azure:azure-storage-blob-batch;12.7.0;12.8.0-beta.2 com.azure:azure-storage-blob-changefeed;12.0.0-beta.4;12.0.0-beta.5 -com.azure:azure-storage-blob-cryptography;12.9.0;12.10.0-beta.1 +com.azure:azure-storage-blob-cryptography;12.9.0;12.10.0-beta.2 com.azure:azure-storage-blob-nio;12.0.0-beta.2;12.0.0-beta.3 -com.azure:azure-storage-common;12.9.0;12.10.0-beta.1 -com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.1 -com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.1 -com.azure:azure-storage-internal-avro;12.0.1;12.1.0-beta.1 +com.azure:azure-storage-common;12.9.0;12.10.0-beta.2 +com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.2 +com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.2 +com.azure:azure-storage-internal-avro;12.0.1;12.0.2-beta.2 com.azure:azure-storage-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-storage-queue;12.7.0;12.8.0-beta.1 +com.azure:azure-storage-queue;12.7.0;12.8.0-beta.2 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 com.azure.spring:azure-spring-boot-starter-active-directory-b2c;3.0.0-beta.1;3.0.0-beta.2 com.azure.spring:azure-spring-boot-starter-active-directory;3.0.0-beta.1;3.0.0-beta.2 @@ -168,6 +173,7 @@ com.azure.resourcemanager:azure-resourcemanager-sql;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-storage;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-trafficmanager;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-test;2.0.0-beta.1;2.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-customproviders;1.0.0-beta.1;1.0.0-beta.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 @@ -176,9 +182,7 @@ com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-b # Format; # unreleased_<groupId>:<artifactId>;dependency-version # note: The unreleased dependencies will not be manipulated with the automatic PR creation code. -unreleased_com.azure:azure-core;1.11.0 -unreleased_com.azure:azure-core-amqp;1.7.0-beta.3 -unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 +unreleased_com.azure:azure-messaging-servicebus;7.0.0 # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current # version and set the version to the released beta. Released beta dependencies are only valid @@ -188,4 +192,3 @@ unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 # beta_<groupId>:<artifactId>;dependency-version # note: Released beta versions will not be manipulated with the automatic PR creation code. beta_com.azure:azure-security-keyvault-keys;4.3.0-beta.1 -beta_com.azure:azure-core-amqp;1.7.0-beta.2 diff --git a/eng/versioning/version_data.txt b/eng/versioning/version_data.txt index 61c6a98825dfd..da53965c2792b 100644 --- a/eng/versioning/version_data.txt +++ b/eng/versioning/version_data.txt @@ -34,7 +34,7 @@ com.microsoft.azure:azure-keyvault-cryptography;1.2.4;1.3.0-beta.1 com.microsoft.azure:azure-keyvault-extensions;1.2.4;1.3.0-beta.1 com.microsoft.azure:azure-keyvault-test;1.2.3;1.2.4 com.microsoft.azure:azure-keyvault-webkey;1.2.4;1.3.0-beta.1 -com.microsoft.azure:azure-servicebus;3.5.0;3.5.1 +com.microsoft.azure:azure-servicebus;3.5.1;3.6.0-beta.1 com.microsoft.azure:azure-storage-blob;11.0.2;11.0.2 com.microsoft.azure.msi_auth_token_provider:azure-authentication-msi-token-provider;1.1.0-beta.1;1.1.0-beta.1 com.microsoft.azure:azure-eventgrid;1.4.0-beta.1;1.4.0-beta.1 diff --git a/pom.xml b/pom.xml index d97614e5dba32..70a024752b952 100644 --- a/pom.xml +++ b/pom.xml @@ -9,17 +9,18 @@ <version>1.0.0</version><!-- Need not change for every release--> <modules> <module>common/perf-test-core</module> - <module>eng/jacoco-test-coverage</module> <module>eng/code-quality-reports</module> + <module>eng/jacoco-test-coverage</module> <module>sdk/anomalydetector</module> <module>sdk/appconfiguration</module> <module>sdk/authorization</module> <module>sdk/batch</module> <module>sdk/boms</module> - <module>sdk/core</module> - <module>sdk/cosmos</module> <module>sdk/cognitiveservices</module> <module>sdk/communication</module> + <module>sdk/core</module> + <module>sdk/cosmos</module> + <module>sdk/customproviders</module> <module>sdk/digitaltwins</module> <module>sdk/eventgrid</module> <module>sdk/eventhubs</module> @@ -28,16 +29,17 @@ <module>sdk/keyvault</module> <module>sdk/loganalytics</module> <module>sdk/mediaservices</module> - <module>sdk/monitor</module> <module>sdk/metricsadvisor</module> + <module>sdk/monitor</module> <module>sdk/resourcemanager</module> <module>sdk/schemaregistry</module> <module>sdk/search</module> <module>sdk/servicebus</module> + <module>sdk/spring</module> <module>sdk/storage</module> + <module>sdk/synapse</module> <module>sdk/tables</module> <module>sdk/template</module> <module>sdk/textanalytics</module> - <module>sdk/spring</module> </modules> </project> diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/CHANGELOG.md b/sdk/customproviders/azure-resourcemanager-customproviders/CHANGELOG.md new file mode 100644 index 0000000000000..3ab075af0f1a1 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-14) + +- 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). \ No newline at end of file diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/README.md b/sdk/customproviders/azure-resourcemanager-customproviders/README.md new file mode 100644 index 0000000000000..f294a30762cc0 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/README.md @@ -0,0 +1,84 @@ +# 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). + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +```xml +<dependency> + <groupId>com.azure.resourcemanager</groupId> + <artifactId>azure-resourcemanager-customproviders</artifactId> + <version>1.0.0-beta.1</version> +</dependency> +``` + +### 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: + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-customproviders;current}) +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +CustomprovidersManager manager = CustomprovidersManager + .authenticate(credential, profile); +``` +[//]: # ({x-version-update-end}) + +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 + +## Troubleshooting + +## Next steps + +## Contributing + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +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 + +<!-- LINKS --> +[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/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/customproviders/azure-resourcemanager-customproviders/pom.xml b/sdk/customproviders/azure-resourcemanager-customproviders/pom.xml new file mode 100644 index 0000000000000..86779f2bab03f --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/pom.xml @@ -0,0 +1,62 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.azure</groupId> + <artifactId>azure-client-sdk-parent</artifactId> + <version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} --> + <relativePath>../../parents/azure-client-sdk-parent</relativePath> + </parent> + + <groupId>com.azure.resourcemanager</groupId> + <artifactId>azure-resourcemanager-customproviders</artifactId> + <version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-customproviders;current} --> + <packaging>jar</packaging> + + <name>Microsoft Azure SDK for Customproviders Management</name> + <description>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 https://aka.ms/azsdk/java/mgmt</description> + <url>https://github.com/Azure/azure-sdk-for-java</url> + + <licenses> + <license> + <name>The MIT License (MIT)</name> + <url>http://opensource.org/licenses/MIT</url> + <distribution>repo</distribution> + </license> + </licenses> + + <scm> + <url>https://github.com/Azure/azure-sdk-for-java</url> + <connection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</connection> + <developerConnection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</developerConnection> + <tag>HEAD</tag> + </scm> + <developers> + <developer> + <id>microsoft</id> + <name>Microsoft</name> + </developer> + </developers> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal> + </properties> + <dependencies> + <dependency> + <groupId>com.azure</groupId> + <artifactId>azure-core-management</artifactId> + <version>1.0.0</version> <!-- {x-version-update;com.azure:azure-core-management;dependency} --> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.8.5</version> <!-- {x-version-update;org.jacoco:jacoco-maven-plugin;external_dependency} --> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> +</project> 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..f6db738171f60 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/CustomprovidersManager.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; + +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.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.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; + +/** 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<HttpPipelinePolicy> policies = 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; + } + + /** + * 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."); + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List<HttpPipelinePolicy> policies = new ArrayList<>(); + policies + .add( + new UserAgentPolicy( + null, + "com.azure.resourcemanager.customproviders", + "1.0.0-beta.1", + Configuration.getGlobalConfiguration())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + 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..ae987f4580fc1 --- /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 resource definition of this 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) + SyncPoller<PollResult<AssociationInner>, 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 resource definition of this 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) + SyncPoller<PollResult<AssociationInner>, 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 resource definition of this 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 resource definition of this 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller<PollResult<Void>, 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller<PollResult<Void>, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response<AssociationInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable<AssociationInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable<AssociationInner> 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..71aeefdb89e05 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/CustomResourceProvidersClient.java @@ -0,0 +1,242 @@ +// 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 A manifest file that defines the custom resource provider resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller<PollResult<CustomRPManifestInner>, 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 A manifest file that defines the custom resource provider resources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller<PollResult<CustomRPManifestInner>, 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 A manifest file that defines the custom resource provider resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 A manifest file that defines the custom resource provider resources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller<PollResult<Void>, 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller<PollResult<Void>, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response<CustomRPManifestInner> 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 custom resource provider update information. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 custom resource provider update information. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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) + Response<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable<CustomRPManifestInner> 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..6c88de1d1c7ba --- /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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable<ResourceProviderOperationInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable<ResourceProviderOperationInner> 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..4aee4e5a6a6f8 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/AssociationInner.java @@ -0,0 +1,69 @@ +// 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.annotation.JsonFlatten; +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. */ +@JsonFlatten +@Fluent +public class AssociationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AssociationInner.class); + + /* + * The REST resource instance of the target resource for this association. + */ + @JsonProperty(value = "properties.targetResourceId") + private String targetResourceId; + + /* + * The provisioning state of the association. + */ + @JsonProperty(value = "properties.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 AssociationInner object itself. + */ + public AssociationInner 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..f6a72b066c3f5 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/fluent/models/CustomRPManifestInner.java @@ -0,0 +1,149 @@ +// 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.annotation.JsonFlatten; +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. */ +@JsonFlatten +@Fluent +public class CustomRPManifestInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomRPManifestInner.class); + + /* + * A list of actions that the custom resource provider implements. + */ + @JsonProperty(value = "properties.actions") + private List<CustomRPActionRouteDefinition> actions; + + /* + * A list of resource types that the custom resource provider implements. + */ + @JsonProperty(value = "properties.resourceTypes") + private List<CustomRPResourceTypeRouteDefinition> resourceTypes; + + /* + * A list of validations to run on the custom resource provider's requests. + */ + @JsonProperty(value = "properties.validations") + private List<CustomRPValidations> validations; + + /* + * The provisioning state of the resource provider. + */ + @JsonProperty(value = "properties.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<CustomRPActionRouteDefinition> 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 CustomRPManifestInner object itself. + */ + public CustomRPManifestInner withActions(List<CustomRPActionRouteDefinition> 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<CustomRPResourceTypeRouteDefinition> 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 CustomRPManifestInner object itself. + */ + public CustomRPManifestInner withResourceTypes(List<CustomRPResourceTypeRouteDefinition> 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<CustomRPValidations> 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 CustomRPManifestInner object itself. + */ + public CustomRPManifestInner withValidations(List<CustomRPValidations> 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; + } + + /** {@inheritDoc} */ + @Override + public CustomRPManifestInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CustomRPManifestInner withTags(Map<String, String> tags) { + super.withTags(tags); + return this; + } + + /** + * 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..05d9db4cf8e41 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationImpl.java @@ -0,0 +1,49 @@ +// 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.CustomprovidersManager; +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 { + private AssociationInner innerObject; + + private final CustomprovidersManager serviceManager; + + public AssociationImpl(AssociationInner innerObject, CustomprovidersManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String targetResourceId() { + return this.innerModel().targetResourceId(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public AssociationInner innerModel() { + return this.innerObject; + } + + private CustomprovidersManager manager() { + return this.serviceManager; + } +} 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..ff374d0b85487 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationsClientImpl.java @@ -0,0 +1,927 @@ +// 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<Response<Flux<ByteBuffer>>> 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<Response<Flux<ByteBuffer>>> 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<Response<AssociationInner>> 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<Response<AssociationsList>> 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<Response<AssociationsList>> 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 resource definition of this 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) + private Mono<Response<Flux<ByteBuffer>>> 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(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 resource definition of this 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) + private Mono<Response<Flux<ByteBuffer>>> 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 resource definition of this 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) + private PollerFlux<PollResult<AssociationInner>, AssociationInner> beginCreateOrUpdateAsync( + String scope, String associationName, AssociationInner association) { + Mono<Response<Flux<ByteBuffer>>> mono = createOrUpdateWithResponseAsync(scope, associationName, association); + return this + .client + .<AssociationInner, AssociationInner>getLroResult( + mono, this.client.getHttpPipeline(), AssociationInner.class, AssociationInner.class, Context.NONE); + } + + /** + * 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 resource definition of this 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) + private PollerFlux<PollResult<AssociationInner>, AssociationInner> beginCreateOrUpdateAsync( + String scope, String associationName, AssociationInner association, Context context) { + context = this.client.mergeContext(context); + Mono<Response<Flux<ByteBuffer>>> mono = + createOrUpdateWithResponseAsync(scope, associationName, association, context); + return this + .client + .<AssociationInner, AssociationInner>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 resource definition of this 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 SyncPoller<PollResult<AssociationInner>, 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 resource definition of this 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 SyncPoller<PollResult<AssociationInner>, 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 resource definition of this 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) + private Mono<AssociationInner> 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 resource definition of this 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) + private Mono<AssociationInner> 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 resource definition of this 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 resource definition of this 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Response<Flux<ByteBuffer>>> 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Response<Flux<ByteBuffer>>> 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(String scope, String associationName) { + Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(scope, associationName); + return this + .client + .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(String scope, String associationName, Context context) { + context = this.client.mergeContext(context); + Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(scope, associationName, context); + return this + .client + .<Void, Void>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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller<PollResult<Void>, 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller<PollResult<Void>, 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Void> 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Void> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Response<AssociationInner>> 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Response<AssociationInner>> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<AssociationInner> getAsync(String scope, String associationName) { + return getWithResponseAsync(scope, associationName) + .flatMap( + (Response<AssociationInner> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response<AssociationInner> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<AssociationInner>> 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)) + .<PagedResponse<AssociationInner>>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<AssociationInner>> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux<AssociationInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux<AssociationInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable<AssociationInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable<AssociationInner> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<AssociationInner>> 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)) + .<PagedResponse<AssociationInner>>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<AssociationInner>> 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..1e448730d3402 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/AssociationsImpl.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.CustomprovidersManager; +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 CustomprovidersManager serviceManager; + + public AssociationsImpl(AssociationsClient innerClient, CustomprovidersManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Association createOrUpdate(String scope, String associationName, AssociationInner association) { + AssociationInner inner = this.serviceClient().createOrUpdate(scope, associationName, association); + if (inner != null) { + return new AssociationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Association createOrUpdate( + String scope, String associationName, AssociationInner association, Context context) { + AssociationInner inner = this.serviceClient().createOrUpdate(scope, associationName, association, context); + if (inner != null) { + return new AssociationImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(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<Association> getWithResponse(String scope, String associationName, Context context) { + Response<AssociationInner> 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<Association> listAll(String scope) { + PagedIterable<AssociationInner> inner = this.serviceClient().listAll(scope); + return inner.mapPage(inner1 -> new AssociationImpl(inner1, this.manager())); + } + + public PagedIterable<Association> listAll(String scope, Context context) { + PagedIterable<AssociationInner> inner = this.serviceClient().listAll(scope, context); + return inner.mapPage(inner1 -> new AssociationImpl(inner1, this.manager())); + } + + private AssociationsClient serviceClient() { + return this.innerClient; + } + + private CustomprovidersManager manager() { + return this.serviceManager; + } +} 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..02118d443029a --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomRPManifestImpl.java @@ -0,0 +1,224 @@ +// 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.CustomprovidersManager; +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 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<String, String> tags() { + Map<String, String> inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public List<CustomRPActionRouteDefinition> actions() { + List<CustomRPActionRouteDefinition> inner = this.innerModel().actions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List<CustomRPResourceTypeRouteDefinition> resourceTypes() { + List<CustomRPResourceTypeRouteDefinition> inner = this.innerModel().resourceTypes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List<CustomRPValidations> validations() { + List<CustomRPValidations> 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 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; + } + + public CustomRPManifestImpl(String name, 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; + } + + public CustomRPManifestImpl(CustomRPManifestInner innerObject, 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<String, String> tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updatePatchableResource.withTags(tags); + return this; + } + } + + public CustomRPManifestImpl withActions(List<CustomRPActionRouteDefinition> actions) { + this.innerModel().withActions(actions); + return this; + } + + public CustomRPManifestImpl withResourceTypes(List<CustomRPResourceTypeRouteDefinition> resourceTypes) { + this.innerModel().withResourceTypes(resourceTypes); + return this; + } + + public CustomRPManifestImpl withValidations(List<CustomRPValidations> 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..ac8d091d20197 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/CustomResourceProvidersClientImpl.java @@ -0,0 +1,1478 @@ +// 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<Response<Flux<ByteBuffer>>> 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<Response<Flux<ByteBuffer>>> 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<Response<CustomRPManifestInner>> 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<Response<CustomRPManifestInner>> 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<Response<ListByCustomRPManifest>> 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<Response<ListByCustomRPManifest>> 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<Response<ListByCustomRPManifest>> 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<Response<ListByCustomRPManifest>> 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 A manifest file that defines the custom resource provider resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Response<Flux<ByteBuffer>>> 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(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 A manifest file that defines the custom resource provider resources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Response<Flux<ByteBuffer>>> 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 A manifest file that defines the custom resource provider resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux<PollResult<CustomRPManifestInner>, CustomRPManifestInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceProviderName, CustomRPManifestInner resourceProvider) { + Mono<Response<Flux<ByteBuffer>>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceProviderName, resourceProvider); + return this + .client + .<CustomRPManifestInner, CustomRPManifestInner>getLroResult( + mono, + this.client.getHttpPipeline(), + CustomRPManifestInner.class, + CustomRPManifestInner.class, + Context.NONE); + } + + /** + * 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 A manifest file that defines the custom resource provider resources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux<PollResult<CustomRPManifestInner>, CustomRPManifestInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String resourceProviderName, + CustomRPManifestInner resourceProvider, + Context context) { + context = this.client.mergeContext(context); + Mono<Response<Flux<ByteBuffer>>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceProviderName, resourceProvider, context); + return this + .client + .<CustomRPManifestInner, CustomRPManifestInner>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 A manifest file that defines the custom resource provider resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller<PollResult<CustomRPManifestInner>, 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 A manifest file that defines the custom resource provider resources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller<PollResult<CustomRPManifestInner>, 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 A manifest file that defines the custom resource provider resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<CustomRPManifestInner> 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 A manifest file that defines the custom resource provider resources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a manifest file that defines the custom resource provider resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<CustomRPManifestInner> 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 A manifest file that defines the custom resource provider resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 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 A manifest file that defines the custom resource provider resources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Response<Flux<ByteBuffer>>> 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Response<Flux<ByteBuffer>>> 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(String resourceGroupName, String resourceProviderName) { + Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(resourceGroupName, resourceProviderName); + return this + .client + .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux<PollResult<Void>, Void> beginDeleteAsync( + String resourceGroupName, String resourceProviderName, Context context) { + context = this.client.mergeContext(context); + Mono<Response<Flux<ByteBuffer>>> mono = + deleteWithResponseAsync(resourceGroupName, resourceProviderName, context); + return this + .client + .<Void, Void>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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller<PollResult<Void>, 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller<PollResult<Void>, 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Void> 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Void> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Response<CustomRPManifestInner>> 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<Response<CustomRPManifestInner>> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<CustomRPManifestInner> getByResourceGroupAsync(String resourceGroupName, String resourceProviderName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceProviderName) + .flatMap( + (Response<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response<CustomRPManifestInner> 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 custom resource provider update information. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) + private Mono<Response<CustomRPManifestInner>> 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 custom resource provider update information. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) + private Mono<Response<CustomRPManifestInner>> 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 custom resource provider update information. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) + private Mono<CustomRPManifestInner> updateAsync( + String resourceGroupName, String resourceProviderName, ResourceProvidersUpdate patchableResource) { + return updateWithResponseAsync(resourceGroupName, resourceProviderName, patchableResource) + .flatMap( + (Response<CustomRPManifestInner> 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 custom resource provider update information. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 custom resource provider update information. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Response<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<CustomRPManifestInner>> 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)) + .<PagedResponse<CustomRPManifestInner>>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<CustomRPManifestInner>> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<CustomRPManifestInner>> 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)) + .<PagedResponse<CustomRPManifestInner>>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<CustomRPManifestInner>> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable<CustomRPManifestInner> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<CustomRPManifestInner>> 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)) + .<PagedResponse<CustomRPManifestInner>>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<CustomRPManifestInner>> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<CustomRPManifestInner>> 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)) + .<PagedResponse<CustomRPManifestInner>>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<CustomRPManifestInner>> 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..60fe617f69f59 --- /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.CustomprovidersManager; +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 CustomprovidersManager serviceManager; + + public CustomResourceProvidersImpl( + CustomResourceProvidersClient innerClient, CustomprovidersManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(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<CustomRPManifest> getByResourceGroupWithResponse( + String resourceGroupName, String resourceProviderName, Context context) { + Response<CustomRPManifestInner> 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<CustomRPManifest> listByResourceGroup(String resourceGroupName) { + PagedIterable<CustomRPManifestInner> inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new CustomRPManifestImpl(inner1, this.manager())); + } + + public PagedIterable<CustomRPManifest> listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable<CustomRPManifestInner> inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new CustomRPManifestImpl(inner1, this.manager())); + } + + public PagedIterable<CustomRPManifest> list() { + PagedIterable<CustomRPManifestInner> inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new CustomRPManifestImpl(inner1, this.manager())); + } + + public PagedIterable<CustomRPManifest> list(Context context) { + PagedIterable<CustomRPManifestInner> inner = this.serviceClient().list(context); + return inner.mapPage(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<CustomRPManifest> 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 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..cda44f893cb4a --- /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<Object, Object> 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 <T> type of poll result. + * @param <U> type of final result. + * @return poller flux for poll result and final result. + */ + public <T, U> PollerFlux<PollResult<T>, U> getLroResult( + Mono<Response<Flux<ByteBuffer>>> 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 <T> type of poll result. + * @param <U> type of final result. + * @return the final result, or an error. + */ + public <T, U> Mono<U> getLroFinalResultOrError(AsyncPollResponse<PollResult<T>, 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 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.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<ByteBuffer> getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono<byte[]> getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono<String> getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono<String> 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..422b4dba08305 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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<Response<ResourceProviderOperationList>> 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<Response<ResourceProviderOperationList>> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<ResourceProviderOperationInner>> 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)) + .<PagedResponse<ResourceProviderOperationInner>>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<ResourceProviderOperationInner>> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux<ResourceProviderOperationInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux<ResourceProviderOperationInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable<ResourceProviderOperationInner> 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable<ResourceProviderOperationInner> 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<ResourceProviderOperationInner>> 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)) + .<PagedResponse<ResourceProviderOperationInner>>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono<PagedResponse<ResourceProviderOperationInner>> 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..f8ca97be5ad94 --- /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.CustomprovidersManager; +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 CustomprovidersManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, CustomprovidersManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable<ResourceProviderOperation> list() { + PagedIterable<ResourceProviderOperationInner> inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + public PagedIterable<ResourceProviderOperation> list(Context context) { + PagedIterable<ResourceProviderOperationInner> inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private 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..1dc0164a4cbdd --- /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.CustomprovidersManager; +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 CustomprovidersManager serviceManager; + + public ResourceProviderOperationImpl( + ResourceProviderOperationInner innerObject, 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 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..3cf12fadc144a --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/implementation/Utils.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.implementation; + +import java.util.Arrays; +import java.util.Iterator; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable<String> iterable = Arrays.asList(id.split("/")); + Iterator<String> itr = iterable.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; + } +} 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<ActionRouting> { + /** 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<ActionRouting> 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..904d0aea99d8a --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Association.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.models; + +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(); +} 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..4f52d4887b633 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/Associations.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.customproviders.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.customproviders.fluent.models.AssociationInner; + +/** Resource collection API of Associations. */ +public interface Associations { + /** + * 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 resource definition of this 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. + */ + Association 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 resource definition of this 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. + */ + Association 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. + */ + 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. + */ + 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. + */ + Response<Association> 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. + */ + PagedIterable<Association> 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. + */ + PagedIterable<Association> listAll(String scope, Context context); +} 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<AssociationInner> 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<AssociationInner> 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<AssociationInner> 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<String, String> tags(); + + /** + * Gets the actions property: A list of actions that the custom resource provider implements. + * + * @return the actions value. + */ + List<CustomRPActionRouteDefinition> actions(); + + /** + * Gets the resourceTypes property: A list of resource types that the custom resource provider implements. + * + * @return the resourceTypes value. + */ + List<CustomRPResourceTypeRouteDefinition> resourceTypes(); + + /** + * Gets the validations property: A list of validations to run on the custom resource provider's requests. + * + * @return the validations value. + */ + List<CustomRPValidations> 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<String, String> 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<CustomRPActionRouteDefinition> 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<CustomRPResourceTypeRouteDefinition> 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<CustomRPValidations> 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<String, String> 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..e6ff1e518edaf --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/CustomResourceProviders.java @@ -0,0 +1,156 @@ +// 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 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. + */ + 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. + */ + Response<CustomRPManifest> 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. + */ + PagedIterable<CustomRPManifest> 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. + */ + PagedIterable<CustomRPManifest> 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. + */ + PagedIterable<CustomRPManifest> 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. + */ + PagedIterable<CustomRPManifest> 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. + */ + 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. + */ + Response<CustomRPManifest> 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<CustomRPManifestInner> 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<CustomRPManifestInner> 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<CustomRPManifestInner> 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..7ca1227b53f26 --- /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. + */ + PagedIterable<ResourceProviderOperation> 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. + */ + PagedIterable<ResourceProviderOperation> 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<ProvisioningState> { + /** 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<ProvisioningState> 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<ResourceProviderOperationInner> 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<ResourceProviderOperationInner> 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<ResourceProviderOperationInner> 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..19b4671fe7961 --- /dev/null +++ b/sdk/customproviders/azure-resourcemanager-customproviders/src/main/java/com/azure/resourcemanager/customproviders/models/ResourceProvidersUpdate.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; +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") + private Map<String, String> tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map<String, String> 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<String, String> 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<ResourceTypeRouting> { + /** 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<ResourceTypeRouting> 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<ValidationType> { + /** 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<ValidationType> 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/ci.yml b/sdk/customproviders/ci.yml new file mode 100644 index 0000000000000..805b0c1745c01 --- /dev/null +++ b/sdk/customproviders/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/customproviders/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/customproviders/ + +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..511f4701c0979 --- /dev/null +++ b/sdk/customproviders/pom.xml @@ -0,0 +1,14 @@ +<!-- Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the MIT License. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.azure</groupId> + <artifactId>azure-customproviders-service</artifactId> + <packaging>pom</packaging> + <version>1.0.0</version><!-- Need not change for every release--> + <modules> + <module>azure-resourcemanager-customproviders</module> + </modules> +</project>