diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 4f3a1a5bfed2a..2974246a80397 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -210,6 +210,7 @@ com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0-beta.2;1.0 com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iothub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-datadog;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index f511c48002b32..f6e9d0ded2523 100644 --- a/pom.xml +++ b/pom.xml @@ -593,8 +593,9 @@ sdk/core sdk/cosmos sdk/costmanagement - sdk/deviceupdate sdk/datadog + sdk/deviceprovisioningservices + sdk/deviceupdate sdk/digitaltwins sdk/eventgrid sdk/eventhubs diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md new file mode 100644 index 0000000000000..40d0640edecd8 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-12) + +- Azure Resource Manager IotDps client library for Java. This package contains Microsoft Azure SDK for IotDps Management SDK. API for using the Azure IoT Hub Device Provisioning Service features. Package tag package-preview-2020-09. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/README.md b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/README.md new file mode 100644 index 0000000000000..398687ee9fdaa --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager IotDps client library for Java + +Azure Resource Manager IotDps client library for Java. + +This package contains Microsoft Azure SDK for IotDps Management SDK. API for using the Azure IoT Hub Device Provisioning Service features. Package tag package-preview-2020-09. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-deviceprovisioningservices + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +IotDpsManager manager = IotDpsManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/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/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml new file mode 100644 index 0000000000000..0df1ac0388e1a --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-deviceprovisioningservices + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for IotDps Management + This package contains Microsoft Azure SDK for IotDps Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API for using the Azure IoT Hub Device Provisioning Service features. Package tag package-preview-2020-09. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.14.0 + + + com.azure + azure-core-management + 1.2.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/IotDpsManager.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/IotDpsManager.java new file mode 100644 index 0000000000000..1fbbf0a265d9b --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/IotDpsManager.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices; + +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.deviceprovisioningservices.fluent.IotDpsClient; +import com.azure.resourcemanager.deviceprovisioningservices.implementation.DpsCertificatesImpl; +import com.azure.resourcemanager.deviceprovisioningservices.implementation.IotDpsClientBuilder; +import com.azure.resourcemanager.deviceprovisioningservices.implementation.IotDpsResourcesImpl; +import com.azure.resourcemanager.deviceprovisioningservices.implementation.OperationsImpl; +import com.azure.resourcemanager.deviceprovisioningservices.models.DpsCertificates; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsResources; +import com.azure.resourcemanager.deviceprovisioningservices.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 IotDpsManager. API for using the Azure IoT Hub Device Provisioning Service features. */ +public final class IotDpsManager { + private Operations operations; + + private DpsCertificates dpsCertificates; + + private IotDpsResources iotDpsResources; + + private final IotDpsClient clientObject; + + private IotDpsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new IotDpsClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of IotDps service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the IotDps service API instance. + */ + public static IotDpsManager 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 IotDpsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new IotDpsManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private 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 IotDps service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the IotDps service API instance. + */ + public IotDpsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.deviceprovisioningservices") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + 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 IotDpsManager(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 DpsCertificates. */ + public DpsCertificates dpsCertificates() { + if (this.dpsCertificates == null) { + this.dpsCertificates = new DpsCertificatesImpl(clientObject.getDpsCertificates(), this); + } + return dpsCertificates; + } + + /** @return Resource collection API of IotDpsResources. */ + public IotDpsResources iotDpsResources() { + if (this.iotDpsResources == null) { + this.iotDpsResources = new IotDpsResourcesImpl(clientObject.getIotDpsResources(), this); + } + return iotDpsResources; + } + + /** + * @return Wrapped service client IotDpsClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public IotDpsClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/DpsCertificatesClient.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/DpsCertificatesClient.java new file mode 100644 index 0000000000000..afb767fd3bf16 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/DpsCertificatesClient.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateBodyDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificatePurpose; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeRequest; +import java.time.OffsetDateTime; + +/** An instance of this class provides access to all the operations defined in DpsCertificatesClient. */ +public interface DpsCertificatesClient { + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateResponseInner get(String certificateName, String resourceGroupName, String provisioningServiceName); + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String certificateName, + String resourceGroupName, + String provisioningServiceName, + String ifMatch, + Context context); + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateResponseInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription); + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription, + String ifMatch, + Context context); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 ifMatch, String provisioningServiceName, String certificateName); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateListDescriptionInner list(String resourceGroupName, String provisioningServiceName); + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceGroupName, String provisioningServiceName, Context context); + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VerificationCodeResponseInner generateVerificationCode( + String certificateName, String ifMatch, String resourceGroupName, String provisioningServiceName); + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response generateVerificationCodeWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateResponseInner verifyCertificate( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response verifyCertificateWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsClient.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsClient.java new file mode 100644 index 0000000000000..139d7f710e8f6 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsClient.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.deviceprovisioningservices.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for IotDpsClient class. */ +public interface IotDpsClient { + /** + * Gets The subscription identifier. + * + * @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 DpsCertificatesClient object to access its operations. + * + * @return the DpsCertificatesClient object. + */ + DpsCertificatesClient getDpsCertificates(); + + /** + * Gets the IotDpsResourcesClient object to access its operations. + * + * @return the IotDpsResourcesClient object. + */ + IotDpsResourcesClient getIotDpsResources(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsResourcesClient.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsResourcesClient.java new file mode 100644 index 0000000000000..937b68b63175a --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsResourcesClient.java @@ -0,0 +1,765 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationInputs; +import com.azure.resourcemanager.deviceprovisioningservices.models.TagsResource; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in IotDpsResourcesClient. */ +public interface IotDpsResourcesClient { + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProvisioningServiceDescriptionInner getByResourceGroup(String resourceGroupName, String provisioningServiceName); + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String provisioningServiceName, Context context); + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ProvisioningServiceDescriptionInner> + beginCreateOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription); + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ProvisioningServiceDescriptionInner> + beginCreateOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context); + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProvisioningServiceDescriptionInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription); + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProvisioningServiceDescriptionInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context); + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ProvisioningServiceDescriptionInner> beginUpdate( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags); + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ProvisioningServiceDescriptionInner> beginUpdate( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context); + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProvisioningServiceDescriptionInner update( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags); + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProvisioningServiceDescriptionInner update( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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, Void> beginDelete(String resourceGroupName, String provisioningServiceName); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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, Void> beginDelete( + String resourceGroupName, String provisioningServiceName, Context context); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioningServiceName); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioningServiceName, Context context); + + /** + * List all the provisioning services for a given subscription id. + * + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all the provisioning services for a given subscription id. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AsyncOperationResultInner getOperationResult( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo); + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOperationResultWithResponse( + String operationId, + String resourceGroupName, + String provisioningServiceName, + String asyncinfo, + Context context); + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listValidSkus(String provisioningServiceName, String resourceGroupName); + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listValidSkus( + String provisioningServiceName, String resourceGroupName, Context context); + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NameAvailabilityInfoInner checkProvisioningServiceNameAvailability(OperationInputs arguments); + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkProvisioningServiceNameAvailabilityWithResponse( + OperationInputs arguments, Context context); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName, Context context); + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner listKeysForKeyName( + String provisioningServiceName, String keyName, String resourceGroupName); + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listKeysForKeyNameWithResponse( + String provisioningServiceName, String keyName, String resourceGroupName, Context context); + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourcesInner listPrivateLinkResources(String resourceGroupName, String resourceName); + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupIdInformationInner getPrivateLinkResources(String resourceGroupName, String resourceName, String groupId); + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context); + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listPrivateEndpointConnections(String resourceGroupName, String resourceName); + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listPrivateEndpointConnectionsWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner getPrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getPrivateEndpointConnectionWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context); + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/OperationsClient.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/OperationsClient.java new file mode 100644 index 0000000000000..8d9a1c355f52a --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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.deviceprovisioningservices.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/AsyncOperationResultInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/AsyncOperationResultInner.java new file mode 100644 index 0000000000000..fec8a52bc5d17 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/AsyncOperationResultInner.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.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorMesssage; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Result of a long running operation. */ +@Fluent +public final class AsyncOperationResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AsyncOperationResultInner.class); + + /* + * current status of a long running operation. + */ + @JsonProperty(value = "status") + private String status; + + /* + * Error message containing code, description and details + */ + @JsonProperty(value = "error") + private ErrorMesssage error; + + /** + * Get the status property: current status of a long running operation. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: current status of a long running operation. + * + * @param status the status value to set. + * @return the AsyncOperationResultInner object itself. + */ + public AsyncOperationResultInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error property: Error message containing code, description and details. + * + * @return the error value. + */ + public ErrorMesssage error() { + return this.error; + } + + /** + * Set the error property: Error message containing code, description and details. + * + * @param error the error value to set. + * @return the AsyncOperationResultInner object itself. + */ + public AsyncOperationResultInner withError(ErrorMesssage error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateListDescriptionInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateListDescriptionInner.java new file mode 100644 index 0000000000000..8384ff271ae56 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateListDescriptionInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JSON-serialized array of Certificate objects. */ +@Fluent +public final class CertificateListDescriptionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateListDescriptionInner.class); + + /* + * The array of Certificate objects. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The array of Certificate objects. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of Certificate objects. + * + * @param value the value value to set. + * @return the CertificateListDescriptionInner object itself. + */ + public CertificateListDescriptionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateResponseInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateResponseInner.java new file mode 100644 index 0000000000000..17f4d9285913d --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateResponseInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The X509 Certificate. */ +@Fluent +public final class CertificateResponseInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateResponseInner.class); + + /* + * properties of a certificate + */ + @JsonProperty(value = "properties") + private CertificateProperties properties; + + /* + * The entity tag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the properties property: properties of a certificate. + * + * @return the properties value. + */ + public CertificateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: properties of a certificate. + * + * @param properties the properties value to set. + * @return the CertificateResponseInner object itself. + */ + public CertificateResponseInner withProperties(CertificateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the etag property: The entity tag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/GroupIdInformationInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/GroupIdInformationInner.java new file mode 100644 index 0000000000000..ee3aa273bb249 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/GroupIdInformationInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.GroupIdInformationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The group information for creating a private endpoint on a provisioning service. */ +@Fluent +public final class GroupIdInformationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GroupIdInformationInner.class); + + /* + * The resource identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The properties for a group information object + */ + @JsonProperty(value = "properties", required = true) + private GroupIdInformationProperties properties; + + /** + * Get the id property: The resource identifier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the properties property: The properties for a group information object. + * + * @return the properties value. + */ + public GroupIdInformationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties for a group information object. + * + * @param properties the properties value to set. + * @return the GroupIdInformationInner object itself. + */ + public GroupIdInformationInner withProperties(GroupIdInformationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model GroupIdInformationInner")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/IotDpsSkuDefinitionInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/IotDpsSkuDefinitionInner.java new file mode 100644 index 0000000000000..03df05de4b889 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/IotDpsSkuDefinitionInner.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.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Available SKUs of tier and units. */ +@Fluent +public final class IotDpsSkuDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDpsSkuDefinitionInner.class); + + /* + * Sku name. + */ + @JsonProperty(value = "name") + private IotDpsSku name; + + /** + * Get the name property: Sku name. + * + * @return the name value. + */ + public IotDpsSku name() { + return this.name; + } + + /** + * Set the name property: Sku name. + * + * @param name the name value to set. + * @return the IotDpsSkuDefinitionInner object itself. + */ + public IotDpsSkuDefinitionInner withName(IotDpsSku name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/NameAvailabilityInfoInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/NameAvailabilityInfoInner.java new file mode 100644 index 0000000000000..edb9361c47f2e --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/NameAvailabilityInfoInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.NameUnavailabilityReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Description of name availability. */ +@Fluent +public final class NameAvailabilityInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityInfoInner.class); + + /* + * specifies if a name is available or not + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * specifies the reason a name is unavailable + */ + @JsonProperty(value = "reason") + private NameUnavailabilityReason reason; + + /* + * message containing a detailed reason name is unavailable + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable property: specifies if a name is available or not. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: specifies if a name is available or not. + * + * @param nameAvailable the nameAvailable value to set. + * @return the NameAvailabilityInfoInner object itself. + */ + public NameAvailabilityInfoInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: specifies the reason a name is unavailable. + * + * @return the reason value. + */ + public NameUnavailabilityReason reason() { + return this.reason; + } + + /** + * Set the reason property: specifies the reason a name is unavailable. + * + * @param reason the reason value to set. + * @return the NameAvailabilityInfoInner object itself. + */ + public NameAvailabilityInfoInner withReason(NameUnavailabilityReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: message containing a detailed reason name is unavailable. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: message containing a detailed reason name is unavailable. + * + * @param message the message value to set. + * @return the NameAvailabilityInfoInner object itself. + */ + public NameAvailabilityInfoInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/OperationInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..db024a14b8f1a --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/OperationInner.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.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Provisioning Service REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{read | write | action | delete} + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{read | write | action | delete}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateEndpointConnectionInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..8763a68b2cd4c --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private endpoint connection of a provisioning service. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * The properties of a private endpoint connection + */ + @JsonProperty(value = "properties", required = true) + private PrivateEndpointConnectionProperties properties; + + /** + * Get the properties property: The properties of a private endpoint connection. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of a private endpoint connection. + * + * @param properties the properties value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model PrivateEndpointConnectionInner")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateLinkResourcesInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateLinkResourcesInner.java new file mode 100644 index 0000000000000..ef5e59a6fee66 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateLinkResourcesInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The available private link resources for a provisioning service. */ +@Fluent +public final class PrivateLinkResourcesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesInner.class); + + /* + * The list of available private link resources for a provisioning service + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of available private link resources for a provisioning service. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of available private link resources for a provisioning service. + * + * @param value the value value to set. + * @return the PrivateLinkResourcesInner object itself. + */ + public PrivateLinkResourcesInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/ProvisioningServiceDescriptionInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/ProvisioningServiceDescriptionInner.java new file mode 100644 index 0000000000000..6ce75d270fcdb --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/ProvisioningServiceDescriptionInner.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.ArmIdentity; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsPropertiesDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The description of the provisioning service. */ +@Fluent +public final class ProvisioningServiceDescriptionInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProvisioningServiceDescriptionInner.class); + + /* + * The Etag field is *not* required. If it is provided in the response + * body, it must also be provided as a header per the normal ETag + * convention. + */ + @JsonProperty(value = "etag") + private String etag; + + /* + * Service specific properties for a provisioning service + */ + @JsonProperty(value = "properties", required = true) + private IotDpsPropertiesDescription properties; + + /* + * Sku info for a provisioning Service. + */ + @JsonProperty(value = "sku", required = true) + private IotDpsSkuInfo sku; + + /* + * The managed identities for the IotDps instance. + */ + @JsonProperty(value = "identity") + private ArmIdentity identity; + + /** + * Get the etag property: The Etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal ETag convention. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal ETag convention. + * + * @param etag the etag value to set. + * @return the ProvisioningServiceDescriptionInner object itself. + */ + public ProvisioningServiceDescriptionInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the properties property: Service specific properties for a provisioning service. + * + * @return the properties value. + */ + public IotDpsPropertiesDescription properties() { + return this.properties; + } + + /** + * Set the properties property: Service specific properties for a provisioning service. + * + * @param properties the properties value to set. + * @return the ProvisioningServiceDescriptionInner object itself. + */ + public ProvisioningServiceDescriptionInner withProperties(IotDpsPropertiesDescription properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku property: Sku info for a provisioning Service. + * + * @return the sku value. + */ + public IotDpsSkuInfo sku() { + return this.sku; + } + + /** + * Set the sku property: Sku info for a provisioning Service. + * + * @param sku the sku value to set. + * @return the ProvisioningServiceDescriptionInner object itself. + */ + public ProvisioningServiceDescriptionInner withSku(IotDpsSkuInfo sku) { + this.sku = sku; + return this; + } + + /** + * Get the identity property: The managed identities for the IotDps instance. + * + * @return the identity value. + */ + public ArmIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed identities for the IotDps instance. + * + * @param identity the identity value to set. + * @return the ProvisioningServiceDescriptionInner object itself. + */ + public ProvisioningServiceDescriptionInner withIdentity(ArmIdentity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public ProvisioningServiceDescriptionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ProvisioningServiceDescriptionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model ProvisioningServiceDescriptionInner")); + } else { + properties().validate(); + } + if (sku() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sku in model ProvisioningServiceDescriptionInner")); + } else { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner.java new file mode 100644 index 0000000000000..3ea3e913f4633 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.AccessRightsDescription; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Description of the shared access key. */ +@Fluent +public final class SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner.class); + + /* + * Name of the key. + */ + @JsonProperty(value = "keyName", required = true) + private String keyName; + + /* + * Primary SAS key value. + */ + @JsonProperty(value = "primaryKey") + private String primaryKey; + + /* + * Secondary SAS key value. + */ + @JsonProperty(value = "secondaryKey") + private String secondaryKey; + + /* + * Rights that this key has. + */ + @JsonProperty(value = "rights", required = true) + private AccessRightsDescription rights; + + /** + * Get the keyName property: Name of the key. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: Name of the key. + * + * @param keyName the keyName value to set. + * @return the SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the primaryKey property: Primary SAS key value. + * + * @return the primaryKey value. + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set the primaryKey property: Primary SAS key value. + * + * @param primaryKey the primaryKey value to set. + * @return the SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get the secondaryKey property: Secondary SAS key value. + * + * @return the secondaryKey value. + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set the secondaryKey property: Secondary SAS key value. + * + * @param secondaryKey the secondaryKey value to set. + * @return the SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get the rights property: Rights that this key has. + * + * @return the rights value. + */ + public AccessRightsDescription rights() { + return this.rights; + } + + /** + * Set the rights property: Rights that this key has. + * + * @param rights the rights value to set. + * @return the SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner withRights( + AccessRightsDescription rights) { + this.rights = rights; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyName in model" + + " SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner")); + } + if (rights() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property rights in model" + + " SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner")); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/VerificationCodeResponseInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/VerificationCodeResponseInner.java new file mode 100644 index 0000000000000..0ba30315dc409 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/VerificationCodeResponseInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeResponseProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Description of the response of the verification code. */ +@Fluent +public final class VerificationCodeResponseInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VerificationCodeResponseInner.class); + + /* + * Request etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private VerificationCodeResponseProperties properties; + + /** + * Get the etag property: Request etag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public VerificationCodeResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the VerificationCodeResponseInner object itself. + */ + public VerificationCodeResponseInner withProperties(VerificationCodeResponseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/package-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/package-info.java new file mode 100644 index 0000000000000..8c49d558e8e2a --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/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 IotDpsClient. API for using the Azure IoT Hub Device Provisioning + * Service features. + */ +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/package-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/package-info.java new file mode 100644 index 0000000000000..80be674d46c58 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/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 IotDpsClient. API for using the Azure IoT Hub Device Provisioning Service + * features. + */ +package com.azure.resourcemanager.deviceprovisioningservices.fluent; diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/AsyncOperationResultImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/AsyncOperationResultImpl.java new file mode 100644 index 0000000000000..092f2aa20f3e3 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/AsyncOperationResultImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.AsyncOperationResult; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorMesssage; + +public final class AsyncOperationResultImpl implements AsyncOperationResult { + private AsyncOperationResultInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + AsyncOperationResultImpl( + AsyncOperationResultInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String status() { + return this.innerModel().status(); + } + + public ErrorMesssage error() { + return this.innerModel().error(); + } + + public AsyncOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateListDescriptionImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateListDescriptionImpl.java new file mode 100644 index 0000000000000..fc152f5659083 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateListDescriptionImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateListDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateResponse; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class CertificateListDescriptionImpl implements CertificateListDescription { + private CertificateListDescriptionInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + CertificateListDescriptionImpl( + CertificateListDescriptionInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new CertificateResponseImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public CertificateListDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateResponseImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateResponseImpl.java new file mode 100644 index 0000000000000..99569d2f2691e --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateResponseImpl.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateBodyDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateProperties; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateResponse; + +public final class CertificateResponseImpl + implements CertificateResponse, CertificateResponse.Definition, CertificateResponse.Update { + private CertificateResponseInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public CertificateProperties properties() { + return this.innerModel().properties(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public CertificateResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String provisioningServiceName; + + private String certificateName; + + private String createIfMatch; + + private CertificateBodyDescription createCertificateDescription; + + private String updateIfMatch; + + private CertificateBodyDescription updateCertificateDescription; + + public CertificateResponseImpl withExistingProvisioningService( + String resourceGroupName, String provisioningServiceName) { + this.resourceGroupName = resourceGroupName; + this.provisioningServiceName = provisioningServiceName; + return this; + } + + public CertificateResponse create() { + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .createOrUpdateWithResponse( + resourceGroupName, + provisioningServiceName, + certificateName, + createCertificateDescription, + createIfMatch, + Context.NONE) + .getValue(); + return this; + } + + public CertificateResponse create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .createOrUpdateWithResponse( + resourceGroupName, + provisioningServiceName, + certificateName, + createCertificateDescription, + createIfMatch, + context) + .getValue(); + return this; + } + + CertificateResponseImpl( + String name, com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = new CertificateResponseInner(); + this.serviceManager = serviceManager; + this.certificateName = name; + this.createIfMatch = null; + this.createCertificateDescription = new CertificateBodyDescription(); + } + + public CertificateResponseImpl update() { + this.updateIfMatch = null; + this.updateCertificateDescription = new CertificateBodyDescription(); + return this; + } + + public CertificateResponse apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .createOrUpdateWithResponse( + resourceGroupName, + provisioningServiceName, + certificateName, + updateCertificateDescription, + updateIfMatch, + Context.NONE) + .getValue(); + return this; + } + + public CertificateResponse apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .createOrUpdateWithResponse( + resourceGroupName, + provisioningServiceName, + certificateName, + updateCertificateDescription, + updateIfMatch, + context) + .getValue(); + return this; + } + + CertificateResponseImpl( + CertificateResponseInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.provisioningServiceName = Utils.getValueFromIdByName(innerObject.id(), "provisioningServices"); + this.certificateName = Utils.getValueFromIdByName(innerObject.id(), "certificates"); + } + + public CertificateResponse refresh() { + String localIfMatch = null; + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .getWithResponse( + certificateName, resourceGroupName, provisioningServiceName, localIfMatch, Context.NONE) + .getValue(); + return this; + } + + public CertificateResponse refresh(Context context) { + String localIfMatch = null; + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .getWithResponse(certificateName, resourceGroupName, provisioningServiceName, localIfMatch, context) + .getValue(); + return this; + } + + public CertificateResponseImpl withCertificate(String certificate) { + if (isInCreateMode()) { + this.createCertificateDescription.withCertificate(certificate); + return this; + } else { + this.updateCertificateDescription.withCertificate(certificate); + return this; + } + } + + public CertificateResponseImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.createIfMatch = ifMatch; + return this; + } else { + this.updateIfMatch = ifMatch; + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesClientImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesClientImpl.java new file mode 100644 index 0000000000000..051626d7ed7f4 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesClientImpl.java @@ -0,0 +1,1984 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Base64Util; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.DpsCertificatesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateBodyDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificatePurpose; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeRequest; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DpsCertificatesClient. */ +public final class DpsCertificatesClientImpl implements DpsCertificatesClient { + private final ClientLogger logger = new ClientLogger(DpsCertificatesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DpsCertificatesService service; + + /** The service client containing this operation class. */ + private final IotDpsClientImpl client; + + /** + * Initializes an instance of DpsCertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DpsCertificatesClientImpl(IotDpsClientImpl client) { + this.service = + RestProxy.create(DpsCertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotDpsClientDpsCertificates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotDpsClientDpsCerti") + private interface DpsCertificatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("certificateName") String certificateName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @HeaderParam("If-Match") String ifMatch, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @BodyParam("application/json") CertificateBodyDescription certificateDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("If-Match") String ifMatch, + @PathParam("provisioningServiceName") String provisioningServiceName, + @PathParam("certificateName") String certificateName, + @QueryParam("certificate.name") String certificateName1, + @QueryParam("certificate.rawBytes") String certificateRawBytes, + @QueryParam("certificate.isVerified") Boolean certificateIsVerified, + @QueryParam("certificate.purpose") CertificatePurpose certificatePurpose, + @QueryParam("certificate.created") OffsetDateTime certificateCreated, + @QueryParam("certificate.lastUpdated") OffsetDateTime certificateLastUpdated, + @QueryParam("certificate.hasPrivateKey") Boolean certificateHasPrivateKey, + @QueryParam("certificate.nonce") String certificateNonce, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates/{certificateName}" + + "/generateVerificationCode") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> generateVerificationCode( + @HostParam("$host") String endpoint, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("certificate.name") String certificateName1, + @QueryParam("certificate.rawBytes") String certificateRawBytes, + @QueryParam("certificate.isVerified") Boolean certificateIsVerified, + @QueryParam("certificate.purpose") CertificatePurpose certificatePurpose, + @QueryParam("certificate.created") OffsetDateTime certificateCreated, + @QueryParam("certificate.lastUpdated") OffsetDateTime certificateLastUpdated, + @QueryParam("certificate.hasPrivateKey") Boolean certificateHasPrivateKey, + @QueryParam("certificate.nonce") String certificateNonce, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> verifyCertificate( + @HostParam("$host") String endpoint, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("certificate.name") String certificateName1, + @QueryParam("certificate.rawBytes") String certificateRawBytes, + @QueryParam("certificate.isVerified") Boolean certificateIsVerified, + @QueryParam("certificate.purpose") CertificatePurpose certificatePurpose, + @QueryParam("certificate.created") OffsetDateTime certificateCreated, + @QueryParam("certificate.lastUpdated") OffsetDateTime certificateLastUpdated, + @QueryParam("certificate.hasPrivateKey") Boolean certificateHasPrivateKey, + @QueryParam("certificate.nonce") String certificateNonce, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VerificationCodeRequest request, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + certificateName, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + ifMatch, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String certificateName, + String resourceGroupName, + String provisioningServiceName, + String ifMatch, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + certificateName, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + ifMatch, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + return getWithResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String certificateName, String resourceGroupName, String provisioningServiceName) { + final String ifMatch = null; + return getWithResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateResponseInner get( + String certificateName, String resourceGroupName, String provisioningServiceName) { + final String ifMatch = null; + return getAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).block(); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String certificateName, + String resourceGroupName, + String provisioningServiceName, + String ifMatch, + Context context) { + return getWithResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, context) + .block(); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription, + String ifMatch) { + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (certificateDescription == null) { + return Mono + .error( + new IllegalArgumentException("Parameter certificateDescription is required and cannot be null.")); + } else { + certificateDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName, + ifMatch, + certificateDescription, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription, + String ifMatch, + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (certificateDescription == null) { + return Mono + .error( + new IllegalArgumentException("Parameter certificateDescription is required and cannot be null.")); + } else { + certificateDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName, + ifMatch, + certificateDescription, + accept, + context); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription, + String ifMatch) { + return createOrUpdateWithResponseAsync( + resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription) { + final String ifMatch = null; + return createOrUpdateWithResponseAsync( + resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateResponseInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription) { + final String ifMatch = null; + return createOrUpdateAsync( + resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch) + .block(); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription, + String ifMatch, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch, context) + .block(); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + 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 (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + final String accept = "application/json"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + 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 (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + final String accept = "application/json"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + return deleteWithResponseAsync( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String ifMatch, String provisioningServiceName, String certificateName) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + return deleteWithResponseAsync( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 ifMatch, String provisioningServiceName, String certificateName) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + deleteAsync( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .block(); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context) + .block(); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String provisioningServiceName) { + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String provisioningServiceName, 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String provisioningServiceName) { + return listWithResponseAsync(resourceGroupName, provisioningServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateListDescriptionInner list(String resourceGroupName, String provisioningServiceName) { + return listAsync(resourceGroupName, provisioningServiceName).block(); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String provisioningServiceName, Context context) { + return listWithResponseAsync(resourceGroupName, provisioningServiceName, context).block(); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateVerificationCodeWithResponseAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + return FluxUtil + .withContext( + context -> + service + .generateVerificationCode( + this.client.getEndpoint(), + certificateName, + ifMatch, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateVerificationCodeWithResponseAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + context = this.client.mergeContext(context); + return service + .generateVerificationCode( + this.client.getEndpoint(), + certificateName, + ifMatch, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateVerificationCodeAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + return generateVerificationCodeWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateVerificationCodeAsync( + String certificateName, String ifMatch, String resourceGroupName, String provisioningServiceName) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + return generateVerificationCodeWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VerificationCodeResponseInner generateVerificationCode( + String certificateName, String ifMatch, String resourceGroupName, String provisioningServiceName) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + return generateVerificationCodeAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .block(); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateVerificationCodeWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + return generateVerificationCodeWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context) + .block(); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> verifyCertificateWithResponseAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + return FluxUtil + .withContext( + context -> + service + .verifyCertificate( + this.client.getEndpoint(), + certificateName, + ifMatch, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + request, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> verifyCertificateWithResponseAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + context = this.client.mergeContext(context); + return service + .verifyCertificate( + this.client.getEndpoint(), + certificateName, + ifMatch, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + request, + accept, + context); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono verifyCertificateAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + return verifyCertificateWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono verifyCertificateAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + return verifyCertificateWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateResponseInner verifyCertificate( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + return verifyCertificateAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .block(); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyCertificateWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + return verifyCertificateWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context) + .block(); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesImpl.java new file mode 100644 index 0000000000000..4557136f8700b --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesImpl.java @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.DpsCertificatesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateListDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificatePurpose; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateResponse; +import com.azure.resourcemanager.deviceprovisioningservices.models.DpsCertificates; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeRequest; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeResponse; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; + +public final class DpsCertificatesImpl implements DpsCertificates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DpsCertificatesImpl.class); + + private final DpsCertificatesClient innerClient; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public DpsCertificatesImpl( + DpsCertificatesClient innerClient, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CertificateResponse get(String certificateName, String resourceGroupName, String provisioningServiceName) { + CertificateResponseInner inner = + this.serviceClient().get(certificateName, resourceGroupName, provisioningServiceName); + if (inner != null) { + return new CertificateResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String certificateName, + String resourceGroupName, + String provisioningServiceName, + String ifMatch, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(certificateName, resourceGroupName, provisioningServiceName, ifMatch, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String ifMatch, String provisioningServiceName, String certificateName) { + this.serviceClient().delete(resourceGroupName, ifMatch, provisioningServiceName, certificateName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context); + } + + public CertificateListDescription list(String resourceGroupName, String provisioningServiceName) { + CertificateListDescriptionInner inner = this.serviceClient().list(resourceGroupName, provisioningServiceName); + if (inner != null) { + return new CertificateListDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceGroupName, String provisioningServiceName, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceGroupName, provisioningServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateListDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VerificationCodeResponse generateVerificationCode( + String certificateName, String ifMatch, String resourceGroupName, String provisioningServiceName) { + VerificationCodeResponseInner inner = + this + .serviceClient() + .generateVerificationCode(certificateName, ifMatch, resourceGroupName, provisioningServiceName); + if (inner != null) { + return new VerificationCodeResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response generateVerificationCodeWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + Response inner = + this + .serviceClient() + .generateVerificationCodeWithResponse( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VerificationCodeResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CertificateResponse verifyCertificate( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request) { + CertificateResponseInner inner = + this + .serviceClient() + .verifyCertificate(certificateName, ifMatch, resourceGroupName, provisioningServiceName, request); + if (inner != null) { + return new CertificateResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response verifyCertificateWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + Response inner = + this + .serviceClient() + .verifyCertificateWithResponse( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CertificateResponse getById(String id) { + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String localIfMatch = null; + return this + .getWithResponse(certificateName, resourceGroupName, provisioningServiceName, localIfMatch, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String ifMatch, Context context) { + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + return this.getWithResponse(certificateName, resourceGroupName, provisioningServiceName, ifMatch, 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", id))); + } + String localIfMatch = null; + String localCertificateName1 = null; + byte[] localCertificateRawBytes = null; + Boolean localCertificateIsVerified = null; + CertificatePurpose localCertificatePurpose = null; + OffsetDateTime localCertificateCreated = null; + OffsetDateTime localCertificateLastUpdated = null; + Boolean localCertificateHasPrivateKey = null; + String localCertificateNonce = null; + this + .deleteWithResponse( + resourceGroupName, + localIfMatch, + provisioningServiceName, + certificateName, + localCertificateName1, + localCertificateRawBytes, + localCertificateIsVerified, + localCertificatePurpose, + localCertificateCreated, + localCertificateLastUpdated, + localCertificateHasPrivateKey, + localCertificateNonce, + Context.NONE) + .getValue(); + } + + public Response deleteByIdWithResponse( + String id, + String ifMatch, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", id))); + } + return this + .deleteWithResponse( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context); + } + + private DpsCertificatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } + + public CertificateResponseImpl define(String name) { + return new CertificateResponseImpl(name, this.manager()); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/GroupIdInformationImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/GroupIdInformationImpl.java new file mode 100644 index 0000000000000..2164f4fb1d7a5 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/GroupIdInformationImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.GroupIdInformation; +import com.azure.resourcemanager.deviceprovisioningservices.models.GroupIdInformationProperties; + +public final class GroupIdInformationImpl implements GroupIdInformation { + private GroupIdInformationInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + GroupIdInformationImpl( + GroupIdInformationInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager 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 GroupIdInformationProperties properties() { + return this.innerModel().properties(); + } + + public GroupIdInformationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientBuilder.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientBuilder.java new file mode 100644 index 0000000000000..7d1a86c228473 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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 IotDpsClientImpl type. */ +@ServiceClientBuilder(serviceClients = {IotDpsClientImpl.class}) +public final class IotDpsClientBuilder { + /* + * The subscription identifier. + */ + private String subscriptionId; + + /** + * Sets The subscription identifier. + * + * @param subscriptionId the subscriptionId value. + * @return the IotDpsClientBuilder. + */ + public IotDpsClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the IotDpsClientBuilder. + */ + public IotDpsClientBuilder 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 IotDpsClientBuilder. + */ + public IotDpsClientBuilder 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 IotDpsClientBuilder. + */ + public IotDpsClientBuilder 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 IotDpsClientBuilder. + */ + public IotDpsClientBuilder 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 IotDpsClientBuilder. + */ + public IotDpsClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of IotDpsClientImpl with the provided parameters. + * + * @return an instance of IotDpsClientImpl. + */ + public IotDpsClientImpl 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(); + } + IotDpsClientImpl client = + new IotDpsClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientImpl.java new file mode 100644 index 0000000000000..cd89737255cd2 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientImpl.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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.deviceprovisioningservices.fluent.DpsCertificatesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.IotDpsClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.IotDpsResourcesClient; +import com.azure.resourcemanager.deviceprovisioningservices.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 IotDpsClientImpl type. */ +@ServiceClient(builder = IotDpsClientBuilder.class) +public final class IotDpsClientImpl implements IotDpsClient { + private final ClientLogger logger = new ClientLogger(IotDpsClientImpl.class); + + /** The subscription identifier. */ + private final String subscriptionId; + + /** + * Gets The subscription identifier. + * + * @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 DpsCertificatesClient object to access its operations. */ + private final DpsCertificatesClient dpsCertificates; + + /** + * Gets the DpsCertificatesClient object to access its operations. + * + * @return the DpsCertificatesClient object. + */ + public DpsCertificatesClient getDpsCertificates() { + return this.dpsCertificates; + } + + /** The IotDpsResourcesClient object to access its operations. */ + private final IotDpsResourcesClient iotDpsResources; + + /** + * Gets the IotDpsResourcesClient object to access its operations. + * + * @return the IotDpsResourcesClient object. + */ + public IotDpsResourcesClient getIotDpsResources() { + return this.iotDpsResources; + } + + /** + * Initializes an instance of IotDpsClient 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 subscription identifier. + * @param endpoint server parameter. + */ + IotDpsClientImpl( + 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 = "2020-09-01-preview"; + this.operations = new OperationsClientImpl(this); + this.dpsCertificates = new DpsCertificatesClientImpl(this); + this.iotDpsResources = new IotDpsResourcesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesClientImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesClientImpl.java new file mode 100644 index 0000000000000..65b152a6dfd75 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesClientImpl.java @@ -0,0 +1,4159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.IotDpsResourcesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuDefinitionListResult; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationInputs; +import com.azure.resourcemanager.deviceprovisioningservices.models.ProvisioningServiceDescriptionListResult; +import com.azure.resourcemanager.deviceprovisioningservices.models.SharedAccessSignatureAuthorizationRuleListResult; +import com.azure.resourcemanager.deviceprovisioningservices.models.TagsResource; +import java.nio.ByteBuffer; +import java.util.List; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotDpsResourcesClient. */ +public final class IotDpsResourcesClientImpl implements IotDpsResourcesClient { + private final ClientLogger logger = new ClientLogger(IotDpsResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotDpsResourcesService service; + + /** The service client containing this operation class. */ + private final IotDpsClientImpl client; + + /** + * Initializes an instance of IotDpsResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotDpsResourcesClientImpl(IotDpsClientImpl client) { + this.service = + RestProxy.create(IotDpsResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotDpsClientIotDpsResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotDpsClientIotDpsRe") + private interface IotDpsResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ProvisioningServiceDescriptionInner iotDpsDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TagsResource provisioningServiceTags, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}") + @ExpectedResponses({200, 202, 204, 404}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/operationresults/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getOperationResult( + @HostParam("$host") String endpoint, + @PathParam("operationId") String operationId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("asyncinfo") String asyncinfo, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listValidSkus( + @HostParam("$host") String endpoint, + @PathParam("provisioningServiceName") String provisioningServiceName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> checkProvisioningServiceNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") OperationInputs arguments, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/listkeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listKeys( + @HostParam("$host") String endpoint, + @PathParam("provisioningServiceName") String provisioningServiceName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listKeysForKeyName( + @HostParam("$host") String endpoint, + @PathParam("provisioningServiceName") String provisioningServiceName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listPrivateLinkResources( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateLinkResources/{groupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getPrivateLinkResources( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("groupId") String groupId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> listPrivateEndpointConnections( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getPrivateEndpointConnection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> createOrUpdatePrivateEndpointConnection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner privateEndpointConnection, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> deletePrivateEndpointConnection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listBySubscriptionNext( + @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(ErrorDetailsException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listValidSkusNext( + @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(ErrorDetailsException.class) + Mono> listKeysNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String provisioningServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + provisioningServiceName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String provisioningServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + provisioningServiceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String provisioningServiceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, provisioningServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProvisioningServiceDescriptionInner getByResourceGroup( + String resourceGroupName, String provisioningServiceName) { + return getByResourceGroupAsync(resourceGroupName, provisioningServiceName).block(); + } + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String provisioningServiceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, provisioningServiceName, context).block(); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription) { + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (iotDpsDescription == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotDpsDescription is required and cannot be null.")); + } else { + iotDpsDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + iotDpsDescription, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (iotDpsDescription == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotDpsDescription is required and cannot be null.")); + } else { + iotDpsDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + iotDpsDescription, + accept, + context); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ProvisioningServiceDescriptionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ProvisioningServiceDescriptionInner.class, + ProvisioningServiceDescriptionInner.class, + Context.NONE); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ProvisioningServiceDescriptionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ProvisioningServiceDescriptionInner.class, + ProvisioningServiceDescriptionInner.class, + context); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ProvisioningServiceDescriptionInner> + beginCreateOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription) { + return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).getSyncPoller(); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ProvisioningServiceDescriptionInner> + beginCreateOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context) + .getSyncPoller(); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription) { + return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProvisioningServiceDescriptionInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription) { + return createOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).block(); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProvisioningServiceDescriptionInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context) { + return createOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context).block(); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (provisioningServiceTags == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceTags is required and cannot be null.")); + } else { + provisioningServiceTags.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + provisioningServiceTags, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (provisioningServiceTags == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceTags is required and cannot be null.")); + } else { + provisioningServiceTags.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + provisioningServiceTags, + accept, + context); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ProvisioningServiceDescriptionInner> + beginUpdateAsync( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ProvisioningServiceDescriptionInner.class, + ProvisioningServiceDescriptionInner.class, + Context.NONE); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ProvisioningServiceDescriptionInner> + beginUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ProvisioningServiceDescriptionInner.class, + ProvisioningServiceDescriptionInner.class, + context); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ProvisioningServiceDescriptionInner> beginUpdate( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { + return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).getSyncPoller(); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ProvisioningServiceDescriptionInner> beginUpdate( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context) { + return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context) + .getSyncPoller(); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { + return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context) { + return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProvisioningServiceDescriptionInner update( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { + return updateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).block(); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProvisioningServiceDescriptionInner update( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context) { + return updateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context).block(); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String provisioningServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + provisioningServiceName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String provisioningServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + provisioningServiceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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, Void> beginDeleteAsync( + String resourceGroupName, String provisioningServiceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, provisioningServiceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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, Void> beginDeleteAsync( + String resourceGroupName, String provisioningServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, provisioningServiceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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, Void> beginDelete(String resourceGroupName, String provisioningServiceName) { + return beginDeleteAsync(resourceGroupName, provisioningServiceName).getSyncPoller(); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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, Void> beginDelete( + String resourceGroupName, String provisioningServiceName, Context context) { + return beginDeleteAsync(resourceGroupName, provisioningServiceName, context).getSyncPoller(); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String provisioningServiceName) { + return beginDeleteAsync(resourceGroupName, provisioningServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String provisioningServiceName, Context context) { + return beginDeleteAsync(resourceGroupName, provisioningServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioningServiceName) { + deleteAsync(resourceGroupName, provisioningServiceName).block(); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioningServiceName, Context context) { + deleteAsync(resourceGroupName, provisioningServiceName, context).block(); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationResultWithResponseAsync( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (asyncinfo == null) { + return Mono.error(new IllegalArgumentException("Parameter asyncinfo is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getOperationResult( + this.client.getEndpoint(), + operationId, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + asyncinfo, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationResultWithResponseAsync( + String operationId, + String resourceGroupName, + String provisioningServiceName, + String asyncinfo, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (asyncinfo == null) { + return Mono.error(new IllegalArgumentException("Parameter asyncinfo is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getOperationResult( + this.client.getEndpoint(), + operationId, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + asyncinfo, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOperationResultAsync( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + return getOperationResultWithResponseAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AsyncOperationResultInner getOperationResult( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + return getOperationResultAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo).block(); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationResultWithResponse( + String operationId, + String resourceGroupName, + String provisioningServiceName, + String asyncinfo, + Context context) { + return getOperationResultWithResponseAsync( + operationId, resourceGroupName, provisioningServiceName, asyncinfo, context) + .block(); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listValidSkusSinglePageAsync( + String provisioningServiceName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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 + .listValidSkus( + this.client.getEndpoint(), + provisioningServiceName, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listValidSkusSinglePageAsync( + String provisioningServiceName, 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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 + .listValidSkus( + this.client.getEndpoint(), + provisioningServiceName, + 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 the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listValidSkusAsync( + String provisioningServiceName, String resourceGroupName) { + return new PagedFlux<>( + () -> listValidSkusSinglePageAsync(provisioningServiceName, resourceGroupName), + nextLink -> listValidSkusNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listValidSkusAsync( + String provisioningServiceName, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listValidSkusSinglePageAsync(provisioningServiceName, resourceGroupName, context), + nextLink -> listValidSkusNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listValidSkus( + String provisioningServiceName, String resourceGroupName) { + return new PagedIterable<>(listValidSkusAsync(provisioningServiceName, resourceGroupName)); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listValidSkus( + String provisioningServiceName, String resourceGroupName, Context context) { + return new PagedIterable<>(listValidSkusAsync(provisioningServiceName, resourceGroupName, context)); + } + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkProvisioningServiceNameAvailabilityWithResponseAsync( + OperationInputs arguments) { + 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 (arguments == null) { + return Mono.error(new IllegalArgumentException("Parameter arguments is required and cannot be null.")); + } else { + arguments.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkProvisioningServiceNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + arguments, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkProvisioningServiceNameAvailabilityWithResponseAsync( + OperationInputs arguments, 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 (arguments == null) { + return Mono.error(new IllegalArgumentException("Parameter arguments is required and cannot be null.")); + } else { + arguments.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkProvisioningServiceNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + arguments, + accept, + context); + } + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkProvisioningServiceNameAvailabilityAsync(OperationInputs arguments) { + return checkProvisioningServiceNameAvailabilityWithResponseAsync(arguments) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NameAvailabilityInfoInner checkProvisioningServiceNameAvailability(OperationInputs arguments) { + return checkProvisioningServiceNameAvailabilityAsync(arguments).block(); + } + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkProvisioningServiceNameAvailabilityWithResponse( + OperationInputs arguments, Context context) { + return checkProvisioningServiceNameAvailabilityWithResponseAsync(arguments, context).block(); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listKeysSinglePageAsync(String provisioningServiceName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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 + .listKeys( + this.client.getEndpoint(), + provisioningServiceName, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listKeysSinglePageAsync(String provisioningServiceName, 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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 + .listKeys( + this.client.getEndpoint(), + provisioningServiceName, + 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)); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listKeysAsync( + String provisioningServiceName, String resourceGroupName) { + return new PagedFlux<>( + () -> listKeysSinglePageAsync(provisioningServiceName, resourceGroupName), + nextLink -> listKeysNextSinglePageAsync(nextLink)); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listKeysAsync( + String provisioningServiceName, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listKeysSinglePageAsync(provisioningServiceName, resourceGroupName, context), + nextLink -> listKeysNextSinglePageAsync(nextLink, context)); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName) { + return new PagedIterable<>(listKeysAsync(provisioningServiceName, resourceGroupName)); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName, Context context) { + return new PagedIterable<>(listKeysAsync(provisioningServiceName, resourceGroupName, context)); + } + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listKeysForKeyNameWithResponseAsync(String provisioningServiceName, String keyName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName 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 + .listKeysForKeyName( + this.client.getEndpoint(), + provisioningServiceName, + keyName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listKeysForKeyNameWithResponseAsync( + String provisioningServiceName, String keyName, 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName 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 + .listKeysForKeyName( + this.client.getEndpoint(), + provisioningServiceName, + keyName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listKeysForKeyNameAsync( + String provisioningServiceName, String keyName, String resourceGroupName) { + return listKeysForKeyNameWithResponseAsync(provisioningServiceName, keyName, resourceGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner listKeysForKeyName( + String provisioningServiceName, String keyName, String resourceGroupName) { + return listKeysForKeyNameAsync(provisioningServiceName, keyName, resourceGroupName).block(); + } + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listKeysForKeyNameWithResponse( + String provisioningServiceName, String keyName, String resourceGroupName, Context context) { + return listKeysForKeyNameWithResponseAsync(provisioningServiceName, keyName, resourceGroupName, context) + .block(); + } + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPrivateLinkResourcesWithResponseAsync( + String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listPrivateLinkResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPrivateLinkResourcesWithResponseAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listPrivateLinkResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listPrivateLinkResourcesAsync( + String resourceGroupName, String resourceName) { + return listPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourcesInner listPrivateLinkResources(String resourceGroupName, String resourceName) { + return listPrivateLinkResourcesAsync(resourceGroupName, resourceName).block(); + } + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, Context context) { + return listPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPrivateLinkResourcesWithResponseAsync( + String resourceGroupName, String resourceName, String groupId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getPrivateLinkResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + groupId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPrivateLinkResourcesWithResponseAsync( + String resourceGroupName, String resourceName, String groupId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getPrivateLinkResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + groupId, + accept, + context); + } + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getPrivateLinkResourcesAsync( + String resourceGroupName, String resourceName, String groupId) { + return getPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName, groupId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupIdInformationInner getPrivateLinkResources( + String resourceGroupName, String resourceName, String groupId) { + return getPrivateLinkResourcesAsync(resourceGroupName, resourceName, groupId).block(); + } + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context) { + return getPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName, groupId, context).block(); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listPrivateEndpointConnectionsWithResponseAsync( + String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listPrivateEndpointConnections( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listPrivateEndpointConnectionsWithResponseAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listPrivateEndpointConnections( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPrivateEndpointConnectionsAsync( + String resourceGroupName, String resourceName) { + return listPrivateEndpointConnectionsWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listPrivateEndpointConnections( + String resourceGroupName, String resourceName) { + return listPrivateEndpointConnectionsAsync(resourceGroupName, resourceName).block(); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listPrivateEndpointConnectionsWithResponse( + String resourceGroupName, String resourceName, Context context) { + return listPrivateEndpointConnectionsWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getPrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getPrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getPrivateEndpointConnectionAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return getPrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner getPrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return getPrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) + .block(); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPrivateEndpointConnectionWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return getPrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, context) + .block(); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdatePrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (privateEndpointConnection == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnection is required and cannot be null.")); + } else { + privateEndpointConnection.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdatePrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdatePrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (privateEndpointConnection == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnection is required and cannot be null.")); + } else { + privateEndpointConnection.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdatePrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + accept, + context); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnectionAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + Mono>> mono = + createOrUpdatePrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnectionAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdatePrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return beginCreateOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + .getSyncPoller(); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return beginCreateOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) + .getSyncPoller(); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdatePrivateEndpointConnectionAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return beginCreateOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdatePrivateEndpointConnectionAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return beginCreateOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return createOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + .block(); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return createOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) + .block(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deletePrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deletePrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deletePrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deletePrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnectionAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + Mono>> mono = + deletePrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnectionAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deletePrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return beginDeletePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) + .getSyncPoller(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return beginDeletePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, context) + .getSyncPoller(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deletePrivateEndpointConnectionAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return beginDeletePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deletePrivateEndpointConnectionAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return beginDeletePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return deletePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) + .block(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return deletePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .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 ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .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 ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 available SKUs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listValidSkusNextSinglePageAsync(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.listValidSkusNext(nextLink, this.client.getEndpoint(), accept, context)) + .>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 ErrorDetailsException 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 available SKUs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listValidSkusNextSinglePageAsync( + 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 + .listValidSkusNext(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 ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listKeysNextSinglePageAsync(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.listKeysNext(nextLink, this.client.getEndpoint(), accept, context)) + .>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 ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listKeysNextSinglePageAsync(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 + .listKeysNext(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/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesImpl.java new file mode 100644 index 0000000000000..a609abdddf817 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesImpl.java @@ -0,0 +1,610 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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.deviceprovisioningservices.fluent.IotDpsResourcesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.AsyncOperationResult; +import com.azure.resourcemanager.deviceprovisioningservices.models.GroupIdInformation; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsResources; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuDefinition; +import com.azure.resourcemanager.deviceprovisioningservices.models.NameAvailabilityInfo; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationInputs; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateEndpointConnection; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateLinkResources; +import com.azure.resourcemanager.deviceprovisioningservices.models.ProvisioningServiceDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class IotDpsResourcesImpl implements IotDpsResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDpsResourcesImpl.class); + + private final IotDpsResourcesClient innerClient; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public IotDpsResourcesImpl( + IotDpsResourcesClient innerClient, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ProvisioningServiceDescription getByResourceGroup(String resourceGroupName, String provisioningServiceName) { + ProvisioningServiceDescriptionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, provisioningServiceName); + if (inner != null) { + return new ProvisioningServiceDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String provisioningServiceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, provisioningServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProvisioningServiceDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String provisioningServiceName) { + this.serviceClient().delete(resourceGroupName, provisioningServiceName); + } + + public void delete(String resourceGroupName, String provisioningServiceName, Context context) { + this.serviceClient().delete(resourceGroupName, provisioningServiceName, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ProvisioningServiceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ProvisioningServiceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ProvisioningServiceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ProvisioningServiceDescriptionImpl(inner1, this.manager())); + } + + public AsyncOperationResult getOperationResult( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + AsyncOperationResultInner inner = + this.serviceClient().getOperationResult(operationId, resourceGroupName, provisioningServiceName, asyncinfo); + if (inner != null) { + return new AsyncOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOperationResultWithResponse( + String operationId, + String resourceGroupName, + String provisioningServiceName, + String asyncinfo, + Context context) { + Response inner = + this + .serviceClient() + .getOperationResultWithResponse( + operationId, resourceGroupName, provisioningServiceName, asyncinfo, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AsyncOperationResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listValidSkus(String provisioningServiceName, String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listValidSkus(provisioningServiceName, resourceGroupName); + return Utils.mapPage(inner, inner1 -> new IotDpsSkuDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listValidSkus( + String provisioningServiceName, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listValidSkus(provisioningServiceName, resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new IotDpsSkuDefinitionImpl(inner1, this.manager())); + } + + public NameAvailabilityInfo checkProvisioningServiceNameAvailability(OperationInputs arguments) { + NameAvailabilityInfoInner inner = this.serviceClient().checkProvisioningServiceNameAvailability(arguments); + if (inner != null) { + return new NameAvailabilityInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkProvisioningServiceNameAvailabilityWithResponse( + OperationInputs arguments, Context context) { + Response inner = + this.serviceClient().checkProvisioningServiceNameAvailabilityWithResponse(arguments, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NameAvailabilityInfoImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listKeys(provisioningServiceName, resourceGroupName); + return Utils + .mapPage( + inner, + inner1 -> + new SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listKeys(provisioningServiceName, resourceGroupName, context); + return Utils + .mapPage( + inner, + inner1 -> + new SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionImpl(inner1, this.manager())); + } + + public SharedAccessSignatureAuthorizationRuleAccessRightsDescription listKeysForKeyName( + String provisioningServiceName, String keyName, String resourceGroupName) { + SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner inner = + this.serviceClient().listKeysForKeyName(provisioningServiceName, keyName, resourceGroupName); + if (inner != null) { + return new SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listKeysForKeyNameWithResponse( + String provisioningServiceName, String keyName, String resourceGroupName, Context context) { + Response inner = + this + .serviceClient() + .listKeysForKeyNameWithResponse(provisioningServiceName, keyName, resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionImpl( + inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateLinkResources listPrivateLinkResources(String resourceGroupName, String resourceName) { + PrivateLinkResourcesInner inner = + this.serviceClient().listPrivateLinkResources(resourceGroupName, resourceName); + if (inner != null) { + return new PrivateLinkResourcesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().listPrivateLinkResourcesWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourcesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GroupIdInformation getPrivateLinkResources(String resourceGroupName, String resourceName, String groupId) { + GroupIdInformationInner inner = + this.serviceClient().getPrivateLinkResources(resourceGroupName, resourceName, groupId); + if (inner != null) { + return new GroupIdInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context) { + Response inner = + this.serviceClient().getPrivateLinkResourcesWithResponse(resourceGroupName, resourceName, groupId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GroupIdInformationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public List listPrivateEndpointConnections( + String resourceGroupName, String resourceName) { + List inner = + this.serviceClient().listPrivateEndpointConnections(resourceGroupName, resourceName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listPrivateEndpointConnectionsWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response> inner = + this.serviceClient().listPrivateEndpointConnectionsWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public PrivateEndpointConnection getPrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .getPrivateEndpointConnection(resourceGroupName, resourceName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getPrivateEndpointConnectionWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getPrivateEndpointConnectionWithResponse( + resourceGroupName, resourceName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .deletePrivateEndpointConnection(resourceGroupName, resourceName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .deletePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, context); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public ProvisioningServiceDescription 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, provisioningServiceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, provisioningServiceName, context); + } + + public PrivateEndpointConnection getPrivateEndpointConnectionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getPrivateEndpointConnectionWithResponse( + resourceGroupName, resourceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getPrivateEndpointConnectionByIdWithResponse( + String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getPrivateEndpointConnectionWithResponse( + resourceGroupName, resourceName, privateEndpointConnectionName, 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + this.delete(resourceGroupName, provisioningServiceName, 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + this.delete(resourceGroupName, provisioningServiceName, context); + } + + public PrivateEndpointConnection deletePrivateEndpointConnectionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .deletePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, Context.NONE); + } + + public PrivateEndpointConnection deletePrivateEndpointConnectionByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .deletePrivateEndpointConnection(resourceGroupName, resourceName, privateEndpointConnectionName, context); + } + + private IotDpsResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } + + public ProvisioningServiceDescriptionImpl define(String name) { + return new ProvisioningServiceDescriptionImpl(name, this.manager()); + } + + public PrivateEndpointConnectionImpl definePrivateEndpointConnection(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsSkuDefinitionImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsSkuDefinitionImpl.java new file mode 100644 index 0000000000000..2bc0903420245 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsSkuDefinitionImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSku; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuDefinition; + +public final class IotDpsSkuDefinitionImpl implements IotDpsSkuDefinition { + private IotDpsSkuDefinitionInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + IotDpsSkuDefinitionImpl( + IotDpsSkuDefinitionInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public IotDpsSku name() { + return this.innerModel().name(); + } + + public IotDpsSkuDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/NameAvailabilityInfoImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/NameAvailabilityInfoImpl.java new file mode 100644 index 0000000000000..2290f12371dd3 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/NameAvailabilityInfoImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.NameAvailabilityInfo; +import com.azure.resourcemanager.deviceprovisioningservices.models.NameUnavailabilityReason; + +public final class NameAvailabilityInfoImpl implements NameAvailabilityInfo { + private NameAvailabilityInfoInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + NameAvailabilityInfoImpl( + NameAvailabilityInfoInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public NameUnavailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public NameAvailabilityInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationImpl.java new file mode 100644 index 0000000000000..0549b35aeb5fa --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.Operation; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsClientImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..1e161280711ab --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.OperationsClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final IotDpsClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(IotDpsClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotDpsClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotDpsClientOperatio") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Devices/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .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 ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..b31fd27b31ce7 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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.deviceprovisioningservices.fluent.OperationsClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.Operation; +import com.azure.resourcemanager.deviceprovisioningservices.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateEndpointConnectionImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..035aaf8ea2437 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateEndpointConnection; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateEndpointConnectionProperties; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointConnectionProperties properties() { + return this.innerModel().properties(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingProvisioningService( + String resourceGroupName, String resourceName) { + this.resourceGroupName = resourceGroupName; + this.resourceName = resourceName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdatePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdatePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdatePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdatePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "provisioningServices"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .getPrivateEndpointConnectionWithResponse( + resourceGroupName, resourceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .getPrivateEndpointConnectionWithResponse( + resourceGroupName, resourceName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withProperties(PrivateEndpointConnectionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateLinkResourcesImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..8110da66f3e9e --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.GroupIdInformation; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateLinkResources; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private PrivateLinkResourcesInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + PrivateLinkResourcesImpl( + PrivateLinkResourcesInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new GroupIdInformationImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourcesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/ProvisioningServiceDescriptionImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/ProvisioningServiceDescriptionImpl.java new file mode 100644 index 0000000000000..fa1675cf432d1 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/ProvisioningServiceDescriptionImpl.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.deviceprovisioningservices.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.ArmIdentity; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsPropertiesDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuInfo; +import com.azure.resourcemanager.deviceprovisioningservices.models.ProvisioningServiceDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.TagsResource; +import java.util.Collections; +import java.util.Map; + +public final class ProvisioningServiceDescriptionImpl + implements ProvisioningServiceDescription, + ProvisioningServiceDescription.Definition, + ProvisioningServiceDescription.Update { + private ProvisioningServiceDescriptionInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public IotDpsPropertiesDescription properties() { + return this.innerModel().properties(); + } + + public IotDpsSkuInfo sku() { + return this.innerModel().sku(); + } + + public ArmIdentity identity() { + return this.innerModel().identity(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ProvisioningServiceDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String provisioningServiceName; + + private TagsResource updateProvisioningServiceTags; + + public ProvisioningServiceDescriptionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ProvisioningServiceDescription create() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate(resourceGroupName, provisioningServiceName, this.innerModel(), Context.NONE); + return this; + } + + public ProvisioningServiceDescription create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate(resourceGroupName, provisioningServiceName, this.innerModel(), context); + return this; + } + + ProvisioningServiceDescriptionImpl( + String name, com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = new ProvisioningServiceDescriptionInner(); + this.serviceManager = serviceManager; + this.provisioningServiceName = name; + } + + public ProvisioningServiceDescriptionImpl update() { + this.updateProvisioningServiceTags = new TagsResource(); + return this; + } + + public ProvisioningServiceDescription apply() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .update(resourceGroupName, provisioningServiceName, updateProvisioningServiceTags, Context.NONE); + return this; + } + + public ProvisioningServiceDescription apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .update(resourceGroupName, provisioningServiceName, updateProvisioningServiceTags, context); + return this; + } + + ProvisioningServiceDescriptionImpl( + ProvisioningServiceDescriptionInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.provisioningServiceName = Utils.getValueFromIdByName(innerObject.id(), "provisioningServices"); + } + + public ProvisioningServiceDescription refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .getByResourceGroupWithResponse(resourceGroupName, provisioningServiceName, Context.NONE) + .getValue(); + return this; + } + + public ProvisioningServiceDescription refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .getByResourceGroupWithResponse(resourceGroupName, provisioningServiceName, context) + .getValue(); + return this; + } + + public PagedIterable listKeys() { + return serviceManager.iotDpsResources().listKeys(provisioningServiceName, resourceGroupName); + } + + public PagedIterable listKeys(Context context) { + return serviceManager.iotDpsResources().listKeys(provisioningServiceName, resourceGroupName, context); + } + + public ProvisioningServiceDescriptionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ProvisioningServiceDescriptionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ProvisioningServiceDescriptionImpl withProperties(IotDpsPropertiesDescription properties) { + this.innerModel().withProperties(properties); + return this; + } + + public ProvisioningServiceDescriptionImpl withSku(IotDpsSkuInfo sku) { + this.innerModel().withSku(sku); + return this; + } + + public ProvisioningServiceDescriptionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProvisioningServiceTags.withTags(tags); + return this; + } + } + + public ProvisioningServiceDescriptionImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public ProvisioningServiceDescriptionImpl withIdentity(ArmIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionImpl.java new file mode 100644 index 0000000000000..b7abd15e9bf98 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.AccessRightsDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription; + +public final class SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionImpl + implements SharedAccessSignatureAuthorizationRuleAccessRightsDescription { + private SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionImpl( + SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String keyName() { + return this.innerModel().keyName(); + } + + public String primaryKey() { + return this.innerModel().primaryKey(); + } + + public String secondaryKey() { + return this.innerModel().secondaryKey(); + } + + public AccessRightsDescription rights() { + return this.innerModel().rights(); + } + + public SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/Utils.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/Utils.java new file mode 100644 index 0000000000000..fd71388112906 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/VerificationCodeResponseImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/VerificationCodeResponseImpl.java new file mode 100644 index 0000000000000..07306a5bd6ef6 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/VerificationCodeResponseImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeResponse; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeResponseProperties; + +public final class VerificationCodeResponseImpl implements VerificationCodeResponse { + private VerificationCodeResponseInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + VerificationCodeResponseImpl( + VerificationCodeResponseInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager 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 etag() { + return this.innerModel().etag(); + } + + public VerificationCodeResponseProperties properties() { + return this.innerModel().properties(); + } + + public VerificationCodeResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/package-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/package-info.java new file mode 100644 index 0000000000000..0df76d0a9398b --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/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 IotDpsClient. API for using the Azure IoT Hub Device Provisioning Service + * features. + */ +package com.azure.resourcemanager.deviceprovisioningservices.implementation; diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AccessRightsDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AccessRightsDescription.java new file mode 100644 index 0000000000000..62829da8b9c05 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AccessRightsDescription.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AccessRightsDescription. */ +public final class AccessRightsDescription extends ExpandableStringEnum { + /** Static value ServiceConfig for AccessRightsDescription. */ + public static final AccessRightsDescription SERVICE_CONFIG = fromString("ServiceConfig"); + + /** Static value EnrollmentRead for AccessRightsDescription. */ + public static final AccessRightsDescription ENROLLMENT_READ = fromString("EnrollmentRead"); + + /** Static value EnrollmentWrite for AccessRightsDescription. */ + public static final AccessRightsDescription ENROLLMENT_WRITE = fromString("EnrollmentWrite"); + + /** Static value DeviceConnect for AccessRightsDescription. */ + public static final AccessRightsDescription DEVICE_CONNECT = fromString("DeviceConnect"); + + /** Static value RegistrationStatusRead for AccessRightsDescription. */ + public static final AccessRightsDescription REGISTRATION_STATUS_READ = fromString("RegistrationStatusRead"); + + /** Static value RegistrationStatusWrite for AccessRightsDescription. */ + public static final AccessRightsDescription REGISTRATION_STATUS_WRITE = fromString("RegistrationStatusWrite"); + + /** + * Creates or finds a AccessRightsDescription from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessRightsDescription. + */ + @JsonCreator + public static AccessRightsDescription fromString(String name) { + return fromString(name, AccessRightsDescription.class); + } + + /** @return known AccessRightsDescription values. */ + public static Collection values() { + return values(AccessRightsDescription.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AllocationPolicy.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AllocationPolicy.java new file mode 100644 index 0000000000000..daaa0e7506da5 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AllocationPolicy.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AllocationPolicy. */ +public final class AllocationPolicy extends ExpandableStringEnum { + /** Static value Hashed for AllocationPolicy. */ + public static final AllocationPolicy HASHED = fromString("Hashed"); + + /** Static value GeoLatency for AllocationPolicy. */ + public static final AllocationPolicy GEO_LATENCY = fromString("GeoLatency"); + + /** Static value Static for AllocationPolicy. */ + public static final AllocationPolicy STATIC = fromString("Static"); + + /** + * Creates or finds a AllocationPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding AllocationPolicy. + */ + @JsonCreator + public static AllocationPolicy fromString(String name) { + return fromString(name, AllocationPolicy.class); + } + + /** @return known AllocationPolicy values. */ + public static Collection values() { + return values(AllocationPolicy.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ArmIdentity.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ArmIdentity.java new file mode 100644 index 0000000000000..721e71a6e1351 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ArmIdentity.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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; + +/** The set of ARM identities associated with the IoT DPS resource. */ +@Fluent +public class ArmIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmIdentity.class); + + /* + * Principal Id + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * Tenant Id + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * Identity type. Only allowed values are SystemAssigned and UserAssigned. + * Comma separated if both for ex: SystemAssigned,UserAssigned. + */ + @JsonProperty(value = "identityType") + private String identityType; + + /* + * The set of UserAssigned identities associated with the IoT DPS resource. + */ + @JsonProperty(value = "userAssignedIdentities") + private Map userAssignedIdentities; + + /** + * Get the principalId property: Principal Id. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: Tenant Id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the identityType property: Identity type. Only allowed values are SystemAssigned and UserAssigned. Comma + * separated if both for ex: SystemAssigned,UserAssigned. + * + * @return the identityType value. + */ + public String identityType() { + return this.identityType; + } + + /** + * Set the identityType property: Identity type. Only allowed values are SystemAssigned and UserAssigned. Comma + * separated if both for ex: SystemAssigned,UserAssigned. + * + * @param identityType the identityType value to set. + * @return the ArmIdentity object itself. + */ + public ArmIdentity withIdentityType(String identityType) { + this.identityType = identityType; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of UserAssigned identities associated with the IoT DPS resource. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of UserAssigned identities associated with the IoT DPS resource. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ArmIdentity object itself. + */ + public ArmIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ArmUserIdentity.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ArmUserIdentity.java new file mode 100644 index 0000000000000..ddc5621b82878 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ArmUserIdentity.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ARM UserAssigned identity information. */ +@Immutable +public class ArmUserIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmUserIdentity.class); + + /* + * Principal Id + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * Client Id + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: Principal Id. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: Client Id. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AsyncOperationResult.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AsyncOperationResult.java new file mode 100644 index 0000000000000..1af5f07ac98c5 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AsyncOperationResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; + +/** An immutable client-side representation of AsyncOperationResult. */ +public interface AsyncOperationResult { + /** + * Gets the status property: current status of a long running operation. + * + * @return the status value. + */ + String status(); + + /** + * Gets the error property: Error message containing code, description and details. + * + * @return the error value. + */ + ErrorMesssage error(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner + * object. + * + * @return the inner object. + */ + AsyncOperationResultInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateBodyDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateBodyDescription.java new file mode 100644 index 0000000000000..5912ba99e132f --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateBodyDescription.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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 JSON-serialized X509 Certificate. */ +@Fluent +public final class CertificateBodyDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateBodyDescription.class); + + /* + * Base-64 representation of the X509 leaf certificate .cer file or just + * .pem file content. + */ + @JsonProperty(value = "certificate") + private String certificate; + + /** + * Get the certificate property: Base-64 representation of the X509 leaf certificate .cer file or just .pem file + * content. + * + * @return the certificate value. + */ + public String certificate() { + return this.certificate; + } + + /** + * Set the certificate property: Base-64 representation of the X509 leaf certificate .cer file or just .pem file + * content. + * + * @param certificate the certificate value to set. + * @return the CertificateBodyDescription object itself. + */ + public CertificateBodyDescription withCertificate(String certificate) { + this.certificate = certificate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateListDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateListDescription.java new file mode 100644 index 0000000000000..90e81a804b1a5 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateListDescription.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import java.util.List; + +/** An immutable client-side representation of CertificateListDescription. */ +public interface CertificateListDescription { + /** + * Gets the value property: The array of Certificate objects. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner + * object. + * + * @return the inner object. + */ + CertificateListDescriptionInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateProperties.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateProperties.java new file mode 100644 index 0000000000000..fb9568736b2fa --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateProperties.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The description of an X509 CA Certificate. */ +@Immutable +public final class CertificateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateProperties.class); + + /* + * The certificate's subject name. + */ + @JsonProperty(value = "subject", access = JsonProperty.Access.WRITE_ONLY) + private String subject; + + /* + * The certificate's expiration date and time. + */ + @JsonProperty(value = "expiry", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 expiry; + + /* + * The certificate's thumbprint. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * Determines whether certificate has been verified. + */ + @JsonProperty(value = "isVerified", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isVerified; + + /* + * The certificate's creation date and time. + */ + @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 created; + + /* + * The certificate's last update date and time. + */ + @JsonProperty(value = "updated", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 updated; + + /** + * Get the subject property: The certificate's subject name. + * + * @return the subject value. + */ + public String subject() { + return this.subject; + } + + /** + * Get the expiry property: The certificate's expiration date and time. + * + * @return the expiry value. + */ + public OffsetDateTime expiry() { + if (this.expiry == null) { + return null; + } + return this.expiry.getDateTime(); + } + + /** + * Get the thumbprint property: The certificate's thumbprint. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the isVerified property: Determines whether certificate has been verified. + * + * @return the isVerified value. + */ + public Boolean isVerified() { + return this.isVerified; + } + + /** + * Get the created property: The certificate's creation date and time. + * + * @return the created value. + */ + public OffsetDateTime created() { + if (this.created == null) { + return null; + } + return this.created.getDateTime(); + } + + /** + * Get the updated property: The certificate's last update date and time. + * + * @return the updated value. + */ + public OffsetDateTime updated() { + if (this.updated == null) { + return null; + } + return this.updated.getDateTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificatePurpose.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificatePurpose.java new file mode 100644 index 0000000000000..0c544924f6124 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificatePurpose.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CertificatePurpose. */ +public final class CertificatePurpose extends ExpandableStringEnum { + /** Static value clientAuthentication for CertificatePurpose. */ + public static final CertificatePurpose CLIENT_AUTHENTICATION = fromString("clientAuthentication"); + + /** Static value serverAuthentication for CertificatePurpose. */ + public static final CertificatePurpose SERVER_AUTHENTICATION = fromString("serverAuthentication"); + + /** + * Creates or finds a CertificatePurpose from its string representation. + * + * @param name a name to look for. + * @return the corresponding CertificatePurpose. + */ + @JsonCreator + public static CertificatePurpose fromString(String name) { + return fromString(name, CertificatePurpose.class); + } + + /** @return known CertificatePurpose values. */ + public static Collection values() { + return values(CertificatePurpose.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateResponse.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateResponse.java new file mode 100644 index 0000000000000..dcf67db6a5b5a --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateResponse.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; + +/** An immutable client-side representation of CertificateResponse. */ +public interface CertificateResponse { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: properties of a certificate. + * + * @return the properties value. + */ + CertificateProperties properties(); + + /** + * Gets the etag property: The entity tag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner + * object. + * + * @return the inner object. + */ + CertificateResponseInner innerModel(); + + /** The entirety of the CertificateResponse definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The CertificateResponse definition stages. */ + interface DefinitionStages { + /** The first stage of the CertificateResponse definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the CertificateResponse definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, provisioningServiceName. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @return the next definition stage. + */ + WithCreate withExistingProvisioningService(String resourceGroupName, String provisioningServiceName); + } + /** + * The stage of the CertificateResponse 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.WithCertificate, DefinitionStages.WithIfMatch { + /** + * Executes the create request. + * + * @return the created resource. + */ + CertificateResponse create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CertificateResponse create(Context context); + } + /** The stage of the CertificateResponse definition allowing to specify certificate. */ + interface WithCertificate { + /** + * Specifies the certificate property: Base-64 representation of the X509 leaf certificate .cer file or just + * .pem file content.. + * + * @param certificate Base-64 representation of the X509 leaf certificate .cer file or just .pem file + * content. + * @return the next definition stage. + */ + WithCreate withCertificate(String certificate); + } + /** The stage of the CertificateResponse definition allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: ETag of the certificate. This is required to update an existing + * certificate, and ignored while creating a brand new certificate.. + * + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored + * while creating a brand new certificate. + * @return the next definition stage. + */ + WithCreate withIfMatch(String ifMatch); + } + } + /** + * Begins update for the CertificateResponse resource. + * + * @return the stage of resource update. + */ + CertificateResponse.Update update(); + + /** The template for CertificateResponse update. */ + interface Update extends UpdateStages.WithCertificate, UpdateStages.WithIfMatch { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CertificateResponse apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CertificateResponse apply(Context context); + } + /** The CertificateResponse update stages. */ + interface UpdateStages { + /** The stage of the CertificateResponse update allowing to specify certificate. */ + interface WithCertificate { + /** + * Specifies the certificate property: Base-64 representation of the X509 leaf certificate .cer file or just + * .pem file content.. + * + * @param certificate Base-64 representation of the X509 leaf certificate .cer file or just .pem file + * content. + * @return the next definition stage. + */ + Update withCertificate(String certificate); + } + /** The stage of the CertificateResponse update allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: ETag of the certificate. This is required to update an existing + * certificate, and ignored while creating a brand new certificate.. + * + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored + * while creating a brand new certificate. + * @return the next definition stage. + */ + Update withIfMatch(String ifMatch); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CertificateResponse refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CertificateResponse refresh(Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/DpsCertificates.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/DpsCertificates.java new file mode 100644 index 0000000000000..a247a6c07db97 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/DpsCertificates.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Resource collection API of DpsCertificates. */ +public interface DpsCertificates { + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + CertificateResponse get(String certificateName, String resourceGroupName, String provisioningServiceName); + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + Response getWithResponse( + String certificateName, + String resourceGroupName, + String provisioningServiceName, + String ifMatch, + Context context); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 ifMatch, String provisioningServiceName, String certificateName); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 certificates tied to the provisioning service. + */ + CertificateListDescription list(String resourceGroupName, String provisioningServiceName); + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 certificates tied to the provisioning service. + */ + Response listWithResponse( + String resourceGroupName, String provisioningServiceName, Context context); + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + VerificationCodeResponse generateVerificationCode( + String certificateName, String ifMatch, String resourceGroupName, String provisioningServiceName); + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + Response generateVerificationCodeWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + CertificateResponse verifyCertificate( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + Response verifyCertificateWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Get the certificate from the provisioning service. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + CertificateResponse getById(String id); + + /** + * Get the certificate from the provisioning service. + * + * @param id the resource ID. + * @param ifMatch ETag of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + Response getByIdWithResponse(String id, String ifMatch, Context context); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param id the resource ID. + * @param ifMatch ETag of the certificate. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse( + String id, + String ifMatch, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Begins definition for a new CertificateResponse resource. + * + * @param name resource name. + * @return the first stage of the new CertificateResponse definition. + */ + CertificateResponse.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/EncryptionKeyIdentity.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/EncryptionKeyIdentity.java new file mode 100644 index 0000000000000..7c50a026d9aec --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/EncryptionKeyIdentity.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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 properties of the identity used to access the key encryption key in KeyVault. */ +@Fluent +public class EncryptionKeyIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionKeyIdentity.class); + + /* + * The user assigned identity. + */ + @JsonProperty(value = "userAssignedIdentity") + private String userAssignedIdentity; + + /** + * Get the userAssignedIdentity property: The user assigned identity. + * + * @return the userAssignedIdentity value. + */ + public String userAssignedIdentity() { + return this.userAssignedIdentity; + } + + /** + * Set the userAssignedIdentity property: The user assigned identity. + * + * @param userAssignedIdentity the userAssignedIdentity value to set. + * @return the EncryptionKeyIdentity object itself. + */ + public EncryptionKeyIdentity withUserAssignedIdentity(String userAssignedIdentity) { + this.userAssignedIdentity = userAssignedIdentity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/EncryptionPropertiesDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/EncryptionPropertiesDescription.java new file mode 100644 index 0000000000000..bfd62b694daba --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/EncryptionPropertiesDescription.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The customer-managed encryption key (CMK) properties for the IoT DPS instance. */ +@Fluent +public final class EncryptionPropertiesDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionPropertiesDescription.class); + + /* + * The source of the encryption key. Typically, Microsoft.KeyVault + */ + @JsonProperty(value = "keySource") + private String keySource; + + /* + * The properties of the encryption key configured in KeyVault. + */ + @JsonProperty(value = "keyVaultProperties") + private List keyVaultProperties; + + /* + * The identity used to access the encryption key in KeyVault. + */ + @JsonProperty(value = "identity") + private EncryptionKeyIdentity identity; + + /** + * Get the keySource property: The source of the encryption key. Typically, Microsoft.KeyVault. + * + * @return the keySource value. + */ + public String keySource() { + return this.keySource; + } + + /** + * Set the keySource property: The source of the encryption key. Typically, Microsoft.KeyVault. + * + * @param keySource the keySource value to set. + * @return the EncryptionPropertiesDescription object itself. + */ + public EncryptionPropertiesDescription withKeySource(String keySource) { + this.keySource = keySource; + return this; + } + + /** + * Get the keyVaultProperties property: The properties of the encryption key configured in KeyVault. + * + * @return the keyVaultProperties value. + */ + public List keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the keyVaultProperties property: The properties of the encryption key configured in KeyVault. + * + * @param keyVaultProperties the keyVaultProperties value to set. + * @return the EncryptionPropertiesDescription object itself. + */ + public EncryptionPropertiesDescription withKeyVaultProperties(List keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** + * Get the identity property: The identity used to access the encryption key in KeyVault. + * + * @return the identity value. + */ + public EncryptionKeyIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity used to access the encryption key in KeyVault. + * + * @param identity the identity value to set. + * @return the EncryptionPropertiesDescription object itself. + */ + public EncryptionPropertiesDescription withIdentity(EncryptionKeyIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyVaultProperties() != null) { + keyVaultProperties().forEach(e -> e.validate()); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetails.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetails.java new file mode 100644 index 0000000000000..db40c21476a85 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetails.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Error details. */ +@Immutable +public final class ErrorDetails extends ManagementError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorDetails.class); + + /* + * The HTTP status code. + */ + @JsonProperty(value = "httpStatusCode", access = JsonProperty.Access.WRITE_ONLY) + private String httpStatusCode; + + /** + * Get the httpStatusCode property: The HTTP status code. + * + * @return the httpStatusCode value. + */ + public String getHttpStatusCode() { + return this.httpStatusCode; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetailsException.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetailsException.java new file mode 100644 index 0000000000000..aa035cedaeb55 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetailsException.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.http.HttpResponse; +import com.azure.core.management.exception.ManagementException; + +/** Exception thrown for an invalid response with ErrorDetails information. */ +public final class ErrorDetailsException extends ManagementException { + /** + * Initializes a new instance of the ErrorDetailsException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public ErrorDetailsException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorDetailsException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public ErrorDetailsException(String message, HttpResponse response, ErrorDetails value) { + super(message, response, value); + } + + @Override + public ErrorDetails getValue() { + return (ErrorDetails) super.getValue(); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorMesssage.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorMesssage.java new file mode 100644 index 0000000000000..5c778550fd570 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorMesssage.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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; + +/** Error response containing message and code. */ +@Fluent +public final class ErrorMesssage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorMesssage.class); + + /* + * standard error code + */ + @JsonProperty(value = "code") + private String code; + + /* + * standard error description + */ + @JsonProperty(value = "message") + private String message; + + /* + * detailed summary of error + */ + @JsonProperty(value = "details") + private String details; + + /** + * Get the code property: standard error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: standard error code. + * + * @param code the code value to set. + * @return the ErrorMesssage object itself. + */ + public ErrorMesssage withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: standard error description. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: standard error description. + * + * @param message the message value to set. + * @return the ErrorMesssage object itself. + */ + public ErrorMesssage withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the details property: detailed summary of error. + * + * @return the details value. + */ + public String details() { + return this.details; + } + + /** + * Set the details property: detailed summary of error. + * + * @param details the details value to set. + * @return the ErrorMesssage object itself. + */ + public ErrorMesssage withDetails(String details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformation.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformation.java new file mode 100644 index 0000000000000..dbcc09fb04149 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformation.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; + +/** An immutable client-side representation of GroupIdInformation. */ +public interface GroupIdInformation { + /** + * Gets the id property: The resource identifier. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The properties for a group information object. + * + * @return the properties value. + */ + GroupIdInformationProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner object. + * + * @return the inner object. + */ + GroupIdInformationInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformationProperties.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformationProperties.java new file mode 100644 index 0000000000000..e733e30b8da39 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformationProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties for a group information object. */ +@Fluent +public final class GroupIdInformationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GroupIdInformationProperties.class); + + /* + * The group id + */ + @JsonProperty(value = "groupId") + private String groupId; + + /* + * The required members for a specific group id + */ + @JsonProperty(value = "requiredMembers") + private List requiredMembers; + + /* + * The required DNS zones for a specific group id + */ + @JsonProperty(value = "requiredZoneNames") + private List requiredZoneNames; + + /** + * Get the groupId property: The group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Set the groupId property: The group id. + * + * @param groupId the groupId value to set. + * @return the GroupIdInformationProperties object itself. + */ + public GroupIdInformationProperties withGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the requiredMembers property: The required members for a specific group id. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Set the requiredMembers property: The required members for a specific group id. + * + * @param requiredMembers the requiredMembers value to set. + * @return the GroupIdInformationProperties object itself. + */ + public GroupIdInformationProperties withRequiredMembers(List requiredMembers) { + this.requiredMembers = requiredMembers; + return this; + } + + /** + * Get the requiredZoneNames property: The required DNS zones for a specific group id. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: The required DNS zones for a specific group id. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the GroupIdInformationProperties object itself. + */ + public GroupIdInformationProperties withRequiredZoneNames(List requiredZoneNames) { + this.requiredZoneNames = requiredZoneNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsPropertiesDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsPropertiesDescription.java new file mode 100644 index 0000000000000..fa6586714ad82 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsPropertiesDescription.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * the service specific properties of a provisioning service, including keys, linked iot hubs, current state, and system + * generated properties such as hostname and idScope. + */ +@Fluent +public final class IotDpsPropertiesDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDpsPropertiesDescription.class); + + /* + * Current state of the provisioning service. + */ + @JsonProperty(value = "state") + private State state; + + /* + * The encryption properties for the IoT DPS instance. + */ + @JsonProperty(value = "encryption") + private EncryptionPropertiesDescription encryption; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * The IP filter rules. + */ + @JsonProperty(value = "ipFilterRules") + private List ipFilterRules; + + /* + * Private endpoint connections created on this IotHub + */ + @JsonProperty(value = "privateEndpointConnections") + private List privateEndpointConnections; + + /* + * The ARM provisioning state of the provisioning service. + */ + @JsonProperty(value = "provisioningState") + private String provisioningState; + + /* + * List of IoT hubs associated with this provisioning service. + */ + @JsonProperty(value = "iotHubs") + private List iotHubs; + + /* + * Allocation policy to be used by this provisioning service. + */ + @JsonProperty(value = "allocationPolicy") + private AllocationPolicy allocationPolicy; + + /* + * Service endpoint for provisioning service. + */ + @JsonProperty(value = "serviceOperationsHostName", access = JsonProperty.Access.WRITE_ONLY) + private String serviceOperationsHostname; + + /* + * Device endpoint for this provisioning service. + */ + @JsonProperty(value = "deviceProvisioningHostName", access = JsonProperty.Access.WRITE_ONLY) + private String deviceProvisioningHostname; + + /* + * Unique identifier of this provisioning service. + */ + @JsonProperty(value = "idScope", access = JsonProperty.Access.WRITE_ONLY) + private String idScope; + + /* + * List of authorization keys for a provisioning service. + */ + @JsonProperty(value = "authorizationPolicies") + private List authorizationPolicies; + + /** + * Get the state property: Current state of the provisioning service. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Set the state property: Current state of the provisioning service. + * + * @param state the state value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withState(State state) { + this.state = state; + return this; + } + + /** + * Get the encryption property: The encryption properties for the IoT DPS instance. + * + * @return the encryption value. + */ + public EncryptionPropertiesDescription encryption() { + return this.encryption; + } + + /** + * Set the encryption property: The encryption properties for the IoT DPS instance. + * + * @param encryption the encryption value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withEncryption(EncryptionPropertiesDescription encryption) { + this.encryption = encryption; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the ipFilterRules property: The IP filter rules. + * + * @return the ipFilterRules value. + */ + public List ipFilterRules() { + return this.ipFilterRules; + } + + /** + * Set the ipFilterRules property: The IP filter rules. + * + * @param ipFilterRules the ipFilterRules value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withIpFilterRules(List ipFilterRules) { + this.ipFilterRules = ipFilterRules; + return this; + } + + /** + * Get the privateEndpointConnections property: Private endpoint connections created on this IotHub. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Set the privateEndpointConnections property: Private endpoint connections created on this IotHub. + * + * @param privateEndpointConnections the privateEndpointConnections value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withPrivateEndpointConnections( + List privateEndpointConnections) { + this.privateEndpointConnections = privateEndpointConnections; + return this; + } + + /** + * Get the provisioningState property: The ARM provisioning state of the provisioning service. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The ARM provisioning state of the provisioning service. + * + * @param provisioningState the provisioningState value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the iotHubs property: List of IoT hubs associated with this provisioning service. + * + * @return the iotHubs value. + */ + public List iotHubs() { + return this.iotHubs; + } + + /** + * Set the iotHubs property: List of IoT hubs associated with this provisioning service. + * + * @param iotHubs the iotHubs value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withIotHubs(List iotHubs) { + this.iotHubs = iotHubs; + return this; + } + + /** + * Get the allocationPolicy property: Allocation policy to be used by this provisioning service. + * + * @return the allocationPolicy value. + */ + public AllocationPolicy allocationPolicy() { + return this.allocationPolicy; + } + + /** + * Set the allocationPolicy property: Allocation policy to be used by this provisioning service. + * + * @param allocationPolicy the allocationPolicy value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withAllocationPolicy(AllocationPolicy allocationPolicy) { + this.allocationPolicy = allocationPolicy; + return this; + } + + /** + * Get the serviceOperationsHostname property: Service endpoint for provisioning service. + * + * @return the serviceOperationsHostname value. + */ + public String serviceOperationsHostname() { + return this.serviceOperationsHostname; + } + + /** + * Get the deviceProvisioningHostname property: Device endpoint for this provisioning service. + * + * @return the deviceProvisioningHostname value. + */ + public String deviceProvisioningHostname() { + return this.deviceProvisioningHostname; + } + + /** + * Get the idScope property: Unique identifier of this provisioning service. + * + * @return the idScope value. + */ + public String idScope() { + return this.idScope; + } + + /** + * Get the authorizationPolicies property: List of authorization keys for a provisioning service. + * + * @return the authorizationPolicies value. + */ + public List authorizationPolicies() { + return this.authorizationPolicies; + } + + /** + * Set the authorizationPolicies property: List of authorization keys for a provisioning service. + * + * @param authorizationPolicies the authorizationPolicies value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withAuthorizationPolicies( + List authorizationPolicies) { + this.authorizationPolicies = authorizationPolicies; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (encryption() != null) { + encryption().validate(); + } + if (ipFilterRules() != null) { + ipFilterRules().forEach(e -> e.validate()); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (iotHubs() != null) { + iotHubs().forEach(e -> e.validate()); + } + if (authorizationPolicies() != null) { + authorizationPolicies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsResources.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsResources.java new file mode 100644 index 0000000000000..8fc4e6d2c03f0 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsResources.java @@ -0,0 +1,532 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of IotDpsResources. */ +public interface IotDpsResources { + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + ProvisioningServiceDescription getByResourceGroup(String resourceGroupName, String provisioningServiceName); + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String provisioningServiceName, Context context); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String provisioningServiceName); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioningServiceName, Context context); + + /** + * List all the provisioning services for a given subscription id. + * + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioning service descriptions. + */ + PagedIterable list(); + + /** + * List all the provisioning services for a given subscription id. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioning service descriptions. + */ + PagedIterable list(Context context); + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all provisioning services in the given resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all provisioning services in the given resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + AsyncOperationResult getOperationResult( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo); + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + Response getOperationResultWithResponse( + String operationId, + String resourceGroupName, + String provisioningServiceName, + String asyncinfo, + Context context); + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + PagedIterable listValidSkus(String provisioningServiceName, String resourceGroupName); + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + PagedIterable listValidSkus( + String provisioningServiceName, String resourceGroupName, Context context); + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + NameAvailabilityInfo checkProvisioningServiceNameAvailability(OperationInputs arguments); + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + Response checkProvisioningServiceNameAvailabilityWithResponse( + OperationInputs arguments, Context context); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName, Context context); + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + SharedAccessSignatureAuthorizationRuleAccessRightsDescription listKeysForKeyName( + String provisioningServiceName, String keyName, String resourceGroupName); + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + Response listKeysForKeyNameWithResponse( + String provisioningServiceName, String keyName, String resourceGroupName, Context context); + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + PrivateLinkResources listPrivateLinkResources(String resourceGroupName, String resourceName); + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + Response listPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + GroupIdInformation getPrivateLinkResources(String resourceGroupName, String resourceName, String groupId); + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context); + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + List listPrivateEndpointConnections(String resourceGroupName, String resourceName); + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + Response> listPrivateEndpointConnectionsWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + PrivateEndpointConnection getPrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + Response getPrivateEndpointConnectionWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + PrivateEndpointConnection deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + PrivateEndpointConnection deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + ProvisioningServiceDescription getById(String id); + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @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.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Get private endpoint connection properties. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + PrivateEndpointConnection getPrivateEndpointConnectionById(String id); + + /** + * Get private endpoint connection properties. + * + * @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.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + Response getPrivateEndpointConnectionByIdWithResponse(String id, Context context); + + /** + * Deletes the Provisioning Service. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 Provisioning Service. + * + * @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.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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); + + /** + * Delete private endpoint connection with the specified name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + PrivateEndpointConnection deletePrivateEndpointConnectionById(String id); + + /** + * Delete private endpoint connection with the specified name. + * + * @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.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + PrivateEndpointConnection deletePrivateEndpointConnectionByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ProvisioningServiceDescription resource. + * + * @param name resource name. + * @return the first stage of the new ProvisioningServiceDescription definition. + */ + ProvisioningServiceDescription.DefinitionStages.Blank define(String name); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank definePrivateEndpointConnection(String name); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSku.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSku.java new file mode 100644 index 0000000000000..cd48f30a8ad85 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSku.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IotDpsSku. */ +public final class IotDpsSku extends ExpandableStringEnum { + /** Static value S1 for IotDpsSku. */ + public static final IotDpsSku S1 = fromString("S1"); + + /** + * Creates or finds a IotDpsSku from its string representation. + * + * @param name a name to look for. + * @return the corresponding IotDpsSku. + */ + @JsonCreator + public static IotDpsSku fromString(String name) { + return fromString(name, IotDpsSku.class); + } + + /** @return known IotDpsSku values. */ + public static Collection values() { + return values(IotDpsSku.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinition.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinition.java new file mode 100644 index 0000000000000..6f7a82eca133b --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinition.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; + +/** An immutable client-side representation of IotDpsSkuDefinition. */ +public interface IotDpsSkuDefinition { + /** + * Gets the name property: Sku name. + * + * @return the name value. + */ + IotDpsSku name(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner + * object. + * + * @return the inner object. + */ + IotDpsSkuDefinitionInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinitionListResult.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinitionListResult.java new file mode 100644 index 0000000000000..3a4c0c233d1dd --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinitionListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of available SKUs. */ +@Fluent +public final class IotDpsSkuDefinitionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDpsSkuDefinitionListResult.class); + + /* + * The list of SKUs + */ + @JsonProperty(value = "value") + private List value; + + /* + * The next link. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of SKUs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of SKUs. + * + * @param value the value value to set. + * @return the IotDpsSkuDefinitionListResult object itself. + */ + public IotDpsSkuDefinitionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The next link. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuInfo.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuInfo.java new file mode 100644 index 0000000000000..ef58310c6f06f --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuInfo.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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; + +/** List of possible provisioning service SKUs. */ +@Fluent +public final class IotDpsSkuInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDpsSkuInfo.class); + + /* + * Sku name. + */ + @JsonProperty(value = "name") + private IotDpsSku name; + + /* + * Pricing tier name of the provisioning service. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private String tier; + + /* + * The number of units to provision + */ + @JsonProperty(value = "capacity") + private Long capacity; + + /** + * Get the name property: Sku name. + * + * @return the name value. + */ + public IotDpsSku name() { + return this.name; + } + + /** + * Set the name property: Sku name. + * + * @param name the name value to set. + * @return the IotDpsSkuInfo object itself. + */ + public IotDpsSkuInfo withName(IotDpsSku name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Pricing tier name of the provisioning service. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Get the capacity property: The number of units to provision. + * + * @return the capacity value. + */ + public Long capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The number of units to provision. + * + * @param capacity the capacity value to set. + * @return the IotDpsSkuInfo object itself. + */ + public IotDpsSkuInfo withCapacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotHubDefinitionDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotHubDefinitionDescription.java new file mode 100644 index 0000000000000..5e6bf27fca155 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotHubDefinitionDescription.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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; + +/** Description of the IoT hub. */ +@Fluent +public final class IotHubDefinitionDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubDefinitionDescription.class); + + /* + * flag for applying allocationPolicy or not for a given iot hub. + */ + @JsonProperty(value = "applyAllocationPolicy") + private Boolean applyAllocationPolicy; + + /* + * weight to apply for a given iot h. + */ + @JsonProperty(value = "allocationWeight") + private Integer allocationWeight; + + /* + * Host name of the IoT hub. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Connection string of the IoT hub. + */ + @JsonProperty(value = "connectionString", required = true) + private String connectionString; + + /* + * ARM region of the IoT hub. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Get the applyAllocationPolicy property: flag for applying allocationPolicy or not for a given iot hub. + * + * @return the applyAllocationPolicy value. + */ + public Boolean applyAllocationPolicy() { + return this.applyAllocationPolicy; + } + + /** + * Set the applyAllocationPolicy property: flag for applying allocationPolicy or not for a given iot hub. + * + * @param applyAllocationPolicy the applyAllocationPolicy value to set. + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withApplyAllocationPolicy(Boolean applyAllocationPolicy) { + this.applyAllocationPolicy = applyAllocationPolicy; + return this; + } + + /** + * Get the allocationWeight property: weight to apply for a given iot h. + * + * @return the allocationWeight value. + */ + public Integer allocationWeight() { + return this.allocationWeight; + } + + /** + * Set the allocationWeight property: weight to apply for a given iot h. + * + * @param allocationWeight the allocationWeight value to set. + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withAllocationWeight(Integer allocationWeight) { + this.allocationWeight = allocationWeight; + return this; + } + + /** + * Get the name property: Host name of the IoT hub. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the connectionString property: Connection string of the IoT hub. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: Connection string of the IoT hub. + * + * @param connectionString the connectionString value to set. + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the location property: ARM region of the IoT hub. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: ARM region of the IoT hub. + * + * @param location the location value to set. + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectionString() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property connectionString in model IotHubDefinitionDescription")); + } + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property location in model IotHubDefinitionDescription")); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterActionType.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterActionType.java new file mode 100644 index 0000000000000..35885518f9492 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterActionType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IpFilterActionType. */ +public enum IpFilterActionType { + /** Enum value Accept. */ + ACCEPT("Accept"), + + /** Enum value Reject. */ + REJECT("Reject"); + + /** The actual serialized value for a IpFilterActionType instance. */ + private final String value; + + IpFilterActionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IpFilterActionType instance. + * + * @param value the serialized value to parse. + * @return the parsed IpFilterActionType object, or null if unable to parse. + */ + @JsonCreator + public static IpFilterActionType fromString(String value) { + IpFilterActionType[] items = IpFilterActionType.values(); + for (IpFilterActionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterRule.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterRule.java new file mode 100644 index 0000000000000..6cf7022ae858f --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterRule.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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 IP filter rules for a provisioning Service. */ +@Fluent +public final class IpFilterRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IpFilterRule.class); + + /* + * The name of the IP filter rule. + */ + @JsonProperty(value = "filterName", required = true) + private String filterName; + + /* + * The desired action for requests captured by this rule. + */ + @JsonProperty(value = "action", required = true) + private IpFilterActionType action; + + /* + * A string that contains the IP address range in CIDR notation for the + * rule. + */ + @JsonProperty(value = "ipMask", required = true) + private String ipMask; + + /* + * Target for requests captured by this rule. + */ + @JsonProperty(value = "target") + private IpFilterTargetType target; + + /** + * Get the filterName property: The name of the IP filter rule. + * + * @return the filterName value. + */ + public String filterName() { + return this.filterName; + } + + /** + * Set the filterName property: The name of the IP filter rule. + * + * @param filterName the filterName value to set. + * @return the IpFilterRule object itself. + */ + public IpFilterRule withFilterName(String filterName) { + this.filterName = filterName; + return this; + } + + /** + * Get the action property: The desired action for requests captured by this rule. + * + * @return the action value. + */ + public IpFilterActionType action() { + return this.action; + } + + /** + * Set the action property: The desired action for requests captured by this rule. + * + * @param action the action value to set. + * @return the IpFilterRule object itself. + */ + public IpFilterRule withAction(IpFilterActionType action) { + this.action = action; + return this; + } + + /** + * Get the ipMask property: A string that contains the IP address range in CIDR notation for the rule. + * + * @return the ipMask value. + */ + public String ipMask() { + return this.ipMask; + } + + /** + * Set the ipMask property: A string that contains the IP address range in CIDR notation for the rule. + * + * @param ipMask the ipMask value to set. + * @return the IpFilterRule object itself. + */ + public IpFilterRule withIpMask(String ipMask) { + this.ipMask = ipMask; + return this; + } + + /** + * Get the target property: Target for requests captured by this rule. + * + * @return the target value. + */ + public IpFilterTargetType target() { + return this.target; + } + + /** + * Set the target property: Target for requests captured by this rule. + * + * @param target the target value to set. + * @return the IpFilterRule object itself. + */ + public IpFilterRule withTarget(IpFilterTargetType target) { + this.target = target; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filterName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property filterName in model IpFilterRule")); + } + if (action() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property action in model IpFilterRule")); + } + if (ipMask() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property ipMask in model IpFilterRule")); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterTargetType.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterTargetType.java new file mode 100644 index 0000000000000..f0eac5bd167fe --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterTargetType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IpFilterTargetType. */ +public enum IpFilterTargetType { + /** Enum value all. */ + ALL("all"), + + /** Enum value serviceApi. */ + SERVICE_API("serviceApi"), + + /** Enum value deviceApi. */ + DEVICE_API("deviceApi"); + + /** The actual serialized value for a IpFilterTargetType instance. */ + private final String value; + + IpFilterTargetType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IpFilterTargetType instance. + * + * @param value the serialized value to parse. + * @return the parsed IpFilterTargetType object, or null if unable to parse. + */ + @JsonCreator + public static IpFilterTargetType fromString(String value) { + IpFilterTargetType[] items = IpFilterTargetType.values(); + for (IpFilterTargetType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/KeyVaultKeyProperties.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/KeyVaultKeyProperties.java new file mode 100644 index 0000000000000..61d38103fb5d0 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/KeyVaultKeyProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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 properties of the KeyVault key. */ +@Fluent +public final class KeyVaultKeyProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultKeyProperties.class); + + /* + * The identifier of the key. + */ + @JsonProperty(value = "keyIdentifier") + private String keyIdentifier; + + /** + * Get the keyIdentifier property: The identifier of the key. + * + * @return the keyIdentifier value. + */ + public String keyIdentifier() { + return this.keyIdentifier; + } + + /** + * Set the keyIdentifier property: The identifier of the key. + * + * @param keyIdentifier the keyIdentifier value to set. + * @return the KeyVaultKeyProperties object itself. + */ + public KeyVaultKeyProperties withKeyIdentifier(String keyIdentifier) { + this.keyIdentifier = keyIdentifier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameAvailabilityInfo.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameAvailabilityInfo.java new file mode 100644 index 0000000000000..026bd80348a4b --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameAvailabilityInfo.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; + +/** An immutable client-side representation of NameAvailabilityInfo. */ +public interface NameAvailabilityInfo { + /** + * Gets the nameAvailable property: specifies if a name is available or not. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: specifies the reason a name is unavailable. + * + * @return the reason value. + */ + NameUnavailabilityReason reason(); + + /** + * Gets the message property: message containing a detailed reason name is unavailable. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner + * object. + * + * @return the inner object. + */ + NameAvailabilityInfoInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameUnavailabilityReason.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameUnavailabilityReason.java new file mode 100644 index 0000000000000..bd8ad76bbbc51 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameUnavailabilityReason.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NameUnavailabilityReason. */ +public final class NameUnavailabilityReason extends ExpandableStringEnum { + /** Static value Invalid for NameUnavailabilityReason. */ + public static final NameUnavailabilityReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for NameUnavailabilityReason. */ + public static final NameUnavailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a NameUnavailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding NameUnavailabilityReason. + */ + @JsonCreator + public static NameUnavailabilityReason fromString(String name) { + return fromString(name, NameUnavailabilityReason.class); + } + + /** @return known NameUnavailabilityReason values. */ + public static Collection values() { + return values(NameUnavailabilityReason.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operation.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operation.java new file mode 100644 index 0000000000000..0666b25ae648d --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operation.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{read | write | action | delete}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationDisplay.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationDisplay.java new file mode 100644 index 0000000000000..35cddad91ec4b --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationDisplay.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft Devices. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * Resource Type: ProvisioningServices. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * Name of the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get the provider property: Service provider: Microsoft Devices. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: Resource Type: ProvisioningServices. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: Name of the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationInputs.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationInputs.java new file mode 100644 index 0000000000000..fd7df2b06c239 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationInputs.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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; + +/** Input values for operation results call. */ +@Fluent +public final class OperationInputs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInputs.class); + + /* + * The name of the Provisioning Service to check. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the name property: The name of the Provisioning Service to check. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the Provisioning Service to check. + * + * @param name the name value to set. + * @return the OperationInputs object itself. + */ + public OperationInputs withName(String name) { + this.name = name; + 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 OperationInputs")); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationListResult.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationListResult.java new file mode 100644 index 0000000000000..1cfd2dbc00b81 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list provisioning service operations. It contains a list of operations and a URL link to get + * the next set of results. + */ +@Immutable +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * Provisioning service operations supported by the Microsoft.Devices + * resource provider. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Provisioning service operations supported by the Microsoft.Devices resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operations.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operations.java new file mode 100644 index 0000000000000..c7e9ed2b0a7ba --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + PagedIterable list(); + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpoint.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpoint.java new file mode 100644 index 0000000000000..b3dce2500658f --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpoint.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private endpoint property of a private endpoint connection. */ +@Immutable +public final class PrivateEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpoint.class); + + /* + * The resource identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: The resource identifier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnection.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..69d8c72cd19b1 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnection.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The properties of a private endpoint connection. + * + * @return the properties value. + */ + PrivateEndpointConnectionProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner + * object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, resourceName. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @return the next definition stage. + */ + WithProperties withExistingProvisioningService(String resourceGroupName, String resourceName); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a private endpoint connection. + * + * @param properties The properties of a private endpoint connection. + * @return the next definition stage. + */ + WithCreate withProperties(PrivateEndpointConnectionProperties properties); + } + /** + * The stage of the PrivateEndpointConnection 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a private endpoint connection. + * + * @param properties The properties of a private endpoint connection. + * @return the next definition stage. + */ + Update withProperties(PrivateEndpointConnectionProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnectionProperties.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..b353bc695f5ea --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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 properties of a private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionProperties.class); + + /* + * The private endpoint property of a private endpoint connection + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpoint privateEndpoint; + + /* + * The current state of a private endpoint connection + */ + @JsonProperty(value = "privateLinkServiceConnectionState", required = true) + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /** + * Get the privateEndpoint property: The private endpoint property of a private endpoint connection. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The private endpoint property of a private endpoint connection. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: The current state of a private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: The current state of a private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateLinkServiceConnectionState in model" + + " PrivateEndpointConnectionProperties")); + } else { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkResources.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..94a6763a69816 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkResources.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the value property: The list of available private link resources for a provisioning service. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner + * object. + * + * @return the inner object. + */ + PrivateLinkResourcesInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionState.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 0000000000000..8ed69f31563fc --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The current state of a private endpoint connection. */ +@Fluent +public final class PrivateLinkServiceConnectionState { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionState.class); + + /* + * The status of a private endpoint connection + */ + @JsonProperty(value = "status", required = true) + private PrivateLinkServiceConnectionStatus status; + + /* + * The description for the current state of a private endpoint connection + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * Actions required for a private endpoint connection + */ + @JsonProperty(value = "actionsRequired") + private String actionsRequired; + + /** + * Get the status property: The status of a private endpoint connection. + * + * @return the status value. + */ + public PrivateLinkServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: The status of a private endpoint connection. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateLinkServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The description for the current state of a private endpoint connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description for the current state of a private endpoint connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: Actions required for a private endpoint connection. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: Actions required for a private endpoint connection. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model PrivateLinkServiceConnectionState")); + } + if (description() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model PrivateLinkServiceConnectionState")); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionStatus.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionStatus.java new file mode 100644 index 0000000000000..057213e262960 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateLinkServiceConnectionStatus. */ +public final class PrivateLinkServiceConnectionStatus extends ExpandableStringEnum { + /** Static value Pending for PrivateLinkServiceConnectionStatus. */ + public static final PrivateLinkServiceConnectionStatus PENDING = fromString("Pending"); + + /** Static value Approved for PrivateLinkServiceConnectionStatus. */ + public static final PrivateLinkServiceConnectionStatus APPROVED = fromString("Approved"); + + /** Static value Rejected for PrivateLinkServiceConnectionStatus. */ + public static final PrivateLinkServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** Static value Disconnected for PrivateLinkServiceConnectionStatus. */ + public static final PrivateLinkServiceConnectionStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStatus. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStatus.class); + } + + /** @return known PrivateLinkServiceConnectionStatus values. */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStatus.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescription.java new file mode 100644 index 0000000000000..e790cd4ad9af2 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescription.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import java.util.Map; + +/** An immutable client-side representation of ProvisioningServiceDescription. */ +public interface ProvisioningServiceDescription { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the etag property: The Etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal ETag convention. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the properties property: Service specific properties for a provisioning service. + * + * @return the properties value. + */ + IotDpsPropertiesDescription properties(); + + /** + * Gets the sku property: Sku info for a provisioning Service. + * + * @return the sku value. + */ + IotDpsSkuInfo sku(); + + /** + * Gets the identity property: The managed identities for the IotDps instance. + * + * @return the identity value. + */ + ArmIdentity identity(); + + /** + * 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.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner object. + * + * @return the inner object. + */ + ProvisioningServiceDescriptionInner innerModel(); + + /** The entirety of the ProvisioningServiceDescription definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, + DefinitionStages.WithSku, + DefinitionStages.WithCreate { + } + /** The ProvisioningServiceDescription definition stages. */ + interface DefinitionStages { + /** The first stage of the ProvisioningServiceDescription definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ProvisioningServiceDescription 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 ProvisioningServiceDescription definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Resource group identifier. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the ProvisioningServiceDescription definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Service specific properties for a provisioning service. + * + * @param properties Service specific properties for a provisioning service. + * @return the next definition stage. + */ + WithSku withProperties(IotDpsPropertiesDescription properties); + } + /** The stage of the ProvisioningServiceDescription definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: Sku info for a provisioning Service.. + * + * @param sku Sku info for a provisioning Service. + * @return the next definition stage. + */ + WithCreate withSku(IotDpsSkuInfo sku); + } + /** + * The stage of the ProvisioningServiceDescription 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.WithEtag, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + ProvisioningServiceDescription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ProvisioningServiceDescription create(Context context); + } + /** The stage of the ProvisioningServiceDescription definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ProvisioningServiceDescription definition allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: The Etag field is *not* required. If it is provided in the response body, it + * must also be provided as a header per the normal ETag convention.. + * + * @param etag The Etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal ETag convention. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + /** The stage of the ProvisioningServiceDescription definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The managed identities for the IotDps instance.. + * + * @param identity The managed identities for the IotDps instance. + * @return the next definition stage. + */ + WithCreate withIdentity(ArmIdentity identity); + } + } + /** + * Begins update for the ProvisioningServiceDescription resource. + * + * @return the stage of resource update. + */ + ProvisioningServiceDescription.Update update(); + + /** The template for ProvisioningServiceDescription update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ProvisioningServiceDescription apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ProvisioningServiceDescription apply(Context context); + } + /** The ProvisioningServiceDescription update stages. */ + interface UpdateStages { + /** The stage of the ProvisioningServiceDescription update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ProvisioningServiceDescription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ProvisioningServiceDescription refresh(Context context); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + PagedIterable listKeys(); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + PagedIterable listKeys(Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescriptionListResult.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescriptionListResult.java new file mode 100644 index 0000000000000..4510504b38ee6 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescriptionListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of provisioning service descriptions. */ +@Fluent +public final class ProvisioningServiceDescriptionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProvisioningServiceDescriptionListResult.class); + + /* + * List of provisioning service descriptions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * the next link + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of provisioning service descriptions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of provisioning service descriptions. + * + * @param value the value value to set. + * @return the ProvisioningServiceDescriptionListResult object itself. + */ + public ProvisioningServiceDescriptionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: the next link. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PublicNetworkAccess.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PublicNetworkAccess.java new file mode 100644 index 0000000000000..3e57aed1daa16 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PublicNetworkAccess.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicNetworkAccess. */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + @JsonCreator + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** @return known PublicNetworkAccess values. */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.java new file mode 100644 index 0000000000000..8a4254c19ba66 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner; + +/** An immutable client-side representation of SharedAccessSignatureAuthorizationRuleAccessRightsDescription. */ +public interface SharedAccessSignatureAuthorizationRuleAccessRightsDescription { + /** + * Gets the keyName property: Name of the key. + * + * @return the keyName value. + */ + String keyName(); + + /** + * Gets the primaryKey property: Primary SAS key value. + * + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * Gets the secondaryKey property: Secondary SAS key value. + * + * @return the secondaryKey value. + */ + String secondaryKey(); + + /** + * Gets the rights property: Rights that this key has. + * + * @return the rights value. + */ + AccessRightsDescription rights(); + + /** + * Gets the inner + * com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner + * object. + * + * @return the inner object. + */ + SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRuleListResult.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRuleListResult.java new file mode 100644 index 0000000000000..e28b869e5ba93 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRuleListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of shared access keys. */ +@Fluent +public final class SharedAccessSignatureAuthorizationRuleListResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(SharedAccessSignatureAuthorizationRuleListResult.class); + + /* + * The list of shared access policies. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The next link. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of shared access policies. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of shared access policies. + * + * @param value the value value to set. + * @return the SharedAccessSignatureAuthorizationRuleListResult object itself. + */ + public SharedAccessSignatureAuthorizationRuleListResult withValue( + List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The next link. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/State.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/State.java new file mode 100644 index 0000000000000..7172f0c00a6cd --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/State.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for State. */ +public final class State extends ExpandableStringEnum { + /** Static value Activating for State. */ + public static final State ACTIVATING = fromString("Activating"); + + /** Static value Active for State. */ + public static final State ACTIVE = fromString("Active"); + + /** Static value Deleting for State. */ + public static final State DELETING = fromString("Deleting"); + + /** Static value Deleted for State. */ + public static final State DELETED = fromString("Deleted"); + + /** Static value ActivationFailed for State. */ + public static final State ACTIVATION_FAILED = fromString("ActivationFailed"); + + /** Static value DeletionFailed for State. */ + public static final State DELETION_FAILED = fromString("DeletionFailed"); + + /** Static value Transitioning for State. */ + public static final State TRANSITIONING = fromString("Transitioning"); + + /** Static value Suspending for State. */ + public static final State SUSPENDING = fromString("Suspending"); + + /** Static value Suspended for State. */ + public static final State SUSPENDED = fromString("Suspended"); + + /** Static value Resuming for State. */ + public static final State RESUMING = fromString("Resuming"); + + /** Static value FailingOver for State. */ + public static final State FAILING_OVER = fromString("FailingOver"); + + /** Static value FailoverFailed for State. */ + public static final State FAILOVER_FAILED = fromString("FailoverFailed"); + + /** + * Creates or finds a State from its string representation. + * + * @param name a name to look for. + * @return the corresponding State. + */ + @JsonCreator + public static State fromString(String name) { + return fromString(name, State.class); + } + + /** @return known State values. */ + public static Collection values() { + return values(State.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/TagsResource.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/TagsResource.java new file mode 100644 index 0000000000000..79db3f22497e2 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/TagsResource.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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; + +/** + * A container holding only the Tags for a resource, allowing the user to update the tags on a Provisioning Service + * instance. + */ +@Fluent +public final class TagsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsResource.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TagsResource object itself. + */ + public TagsResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeRequest.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeRequest.java new file mode 100644 index 0000000000000..6fe1d7dfe585d --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeRequest.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.deviceprovisioningservices.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 JSON-serialized leaf certificate. */ +@Fluent +public final class VerificationCodeRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VerificationCodeRequest.class); + + /* + * base-64 representation of X509 certificate .cer file or just .pem file + * content. + */ + @JsonProperty(value = "certificate") + private String certificate; + + /** + * Get the certificate property: base-64 representation of X509 certificate .cer file or just .pem file content. + * + * @return the certificate value. + */ + public String certificate() { + return this.certificate; + } + + /** + * Set the certificate property: base-64 representation of X509 certificate .cer file or just .pem file content. + * + * @param certificate the certificate value to set. + * @return the VerificationCodeRequest object itself. + */ + public VerificationCodeRequest withCertificate(String certificate) { + this.certificate = certificate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponse.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponse.java new file mode 100644 index 0000000000000..837f69b8fd871 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponse.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; + +/** An immutable client-side representation of VerificationCodeResponse. */ +public interface VerificationCodeResponse { + /** + * 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 etag property: Request etag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the properties property: The properties property. + * + * @return the properties value. + */ + VerificationCodeResponseProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner + * object. + * + * @return the inner object. + */ + VerificationCodeResponseInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponseProperties.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponseProperties.java new file mode 100644 index 0000000000000..2e4d7936d6b3b --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponseProperties.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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 VerificationCodeResponseProperties model. */ +@Fluent +public final class VerificationCodeResponseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VerificationCodeResponseProperties.class); + + /* + * Verification code. + */ + @JsonProperty(value = "verificationCode") + private String verificationCode; + + /* + * Certificate subject. + */ + @JsonProperty(value = "subject") + private String subject; + + /* + * Code expiry. + */ + @JsonProperty(value = "expiry") + private String expiry; + + /* + * Certificate thumbprint. + */ + @JsonProperty(value = "thumbprint") + private String thumbprint; + + /* + * Indicate if the certificate is verified by owner of private key. + */ + @JsonProperty(value = "isVerified") + private Boolean isVerified; + + /* + * Certificate created time. + */ + @JsonProperty(value = "created") + private String created; + + /* + * Certificate updated time. + */ + @JsonProperty(value = "updated") + private String updated; + + /** + * Get the verificationCode property: Verification code. + * + * @return the verificationCode value. + */ + public String verificationCode() { + return this.verificationCode; + } + + /** + * Set the verificationCode property: Verification code. + * + * @param verificationCode the verificationCode value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withVerificationCode(String verificationCode) { + this.verificationCode = verificationCode; + return this; + } + + /** + * Get the subject property: Certificate subject. + * + * @return the subject value. + */ + public String subject() { + return this.subject; + } + + /** + * Set the subject property: Certificate subject. + * + * @param subject the subject value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withSubject(String subject) { + this.subject = subject; + return this; + } + + /** + * Get the expiry property: Code expiry. + * + * @return the expiry value. + */ + public String expiry() { + return this.expiry; + } + + /** + * Set the expiry property: Code expiry. + * + * @param expiry the expiry value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withExpiry(String expiry) { + this.expiry = expiry; + return this; + } + + /** + * Get the thumbprint property: Certificate thumbprint. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint property: Certificate thumbprint. + * + * @param thumbprint the thumbprint value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the isVerified property: Indicate if the certificate is verified by owner of private key. + * + * @return the isVerified value. + */ + public Boolean isVerified() { + return this.isVerified; + } + + /** + * Set the isVerified property: Indicate if the certificate is verified by owner of private key. + * + * @param isVerified the isVerified value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withIsVerified(Boolean isVerified) { + this.isVerified = isVerified; + return this; + } + + /** + * Get the created property: Certificate created time. + * + * @return the created value. + */ + public String created() { + return this.created; + } + + /** + * Set the created property: Certificate created time. + * + * @param created the created value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withCreated(String created) { + this.created = created; + return this; + } + + /** + * Get the updated property: Certificate updated time. + * + * @return the updated value. + */ + public String updated() { + return this.updated; + } + + /** + * Set the updated property: Certificate updated time. + * + * @param updated the updated value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withUpdated(String updated) { + this.updated = updated; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/package-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/package-info.java new file mode 100644 index 0000000000000..54fb7f454b541 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/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 IotDpsClient. API for using the Azure IoT Hub Device Provisioning Service + * features. + */ +package com.azure.resourcemanager.deviceprovisioningservices.models; diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/package-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/package-info.java new file mode 100644 index 0000000000000..b472705c7cfe9 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/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 IotDpsClient. API for using the Azure IoT Hub Device Provisioning Service + * features. + */ +package com.azure.resourcemanager.deviceprovisioningservices; diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/module-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/module-info.java new file mode 100644 index 0000000000000..225be0fc41354 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/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.deviceprovisioningservices { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.deviceprovisioningservices; + exports com.azure.resourcemanager.deviceprovisioningservices.fluent; + exports com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + exports com.azure.resourcemanager.deviceprovisioningservices.models; + + opens com.azure.resourcemanager.deviceprovisioningservices.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.deviceprovisioningservices.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/deviceprovisioningservices/ci.yml b/sdk/deviceprovisioningservices/ci.yml new file mode 100644 index 0000000000000..db51377290549 --- /dev/null +++ b/sdk/deviceprovisioningservices/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/deviceprovisioningservices/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceprovisioningservices/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: deviceprovisioningservices + Artifacts: + - name: azure-resourcemanager-deviceprovisioningservices + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdeviceprovisioningservices diff --git a/sdk/deviceprovisioningservices/pom.xml b/sdk/deviceprovisioningservices/pom.xml new file mode 100644 index 0000000000000..40af7c335f820 --- /dev/null +++ b/sdk/deviceprovisioningservices/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-deviceprovisioningservices-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-deviceprovisioningservices + + + +