diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 5b180d642ed04..9f668997db9db 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -187,6 +187,7 @@ com.azure.resourcemanager:azure-resourcemanager-recoveryservices;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-kusto;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-eventgrid;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.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index b80dac967d8f2..fbf768f72640f 100644 --- a/pom.xml +++ b/pom.xml @@ -27,6 +27,7 @@ sdk/formrecognizer sdk/hdinsight sdk/identity + sdk/iothub sdk/keyvault sdk/kusto sdk/loganalytics diff --git a/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md b/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md new file mode 100644 index 0000000000000..27ca1fcdf74f7 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-01-05) + +- Azure Resource Manager IotHub client library for Java. This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-2020-08-31. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). \ No newline at end of file diff --git a/sdk/iothub/azure-resourcemanager-iothub/README.md b/sdk/iothub/azure-resourcemanager-iothub/README.md new file mode 100644 index 0000000000000..3470ce4591235 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/README.md @@ -0,0 +1,83 @@ +# Azure Resource Manager IotHub client library for Java + +Azure Resource Manager IotHub client library for Java. + +This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-2020-08-31. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-iothub;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-iothub + 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(); +IotHubManager manager = IotHubManager + .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 + + +[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/iothub/azure-resourcemanager-iothub/pom.xml b/sdk/iothub/azure-resourcemanager-iothub/pom.xml new file mode 100644 index 0000000000000..d2f86bb22593c --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-iothub + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for IotHub Management + This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-2020-08-31. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + 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-management + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java new file mode 100644 index 0000000000000..7b7fbdc8505ad --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub; + +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.iothub.fluent.IotHubClient; +import com.azure.resourcemanager.iothub.implementation.CertificatesImpl; +import com.azure.resourcemanager.iothub.implementation.IotHubClientBuilder; +import com.azure.resourcemanager.iothub.implementation.IotHubResourcesImpl; +import com.azure.resourcemanager.iothub.implementation.IotHubsImpl; +import com.azure.resourcemanager.iothub.implementation.OperationsImpl; +import com.azure.resourcemanager.iothub.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.iothub.implementation.PrivateLinkResourcesOperationsImpl; +import com.azure.resourcemanager.iothub.implementation.ResourceProviderCommonsImpl; +import com.azure.resourcemanager.iothub.models.Certificates; +import com.azure.resourcemanager.iothub.models.IotHubResources; +import com.azure.resourcemanager.iothub.models.IotHubs; +import com.azure.resourcemanager.iothub.models.Operations; +import com.azure.resourcemanager.iothub.models.PrivateEndpointConnections; +import com.azure.resourcemanager.iothub.models.PrivateLinkResourcesOperations; +import com.azure.resourcemanager.iothub.models.ResourceProviderCommons; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to IotHubManager. Use this API to manage the IoT hubs in your Azure subscription. */ +public final class IotHubManager { + private Operations operations; + + private IotHubResources iotHubResources; + + private ResourceProviderCommons resourceProviderCommons; + + private Certificates certificates; + + private IotHubs iotHubs; + + private PrivateLinkResourcesOperations privateLinkResourcesOperations; + + private PrivateEndpointConnections privateEndpointConnections; + + private final IotHubClient clientObject; + + private IotHubManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new IotHubClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of IotHub service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the IotHub service API instance. + */ + public static IotHubManager 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 IotHubManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new IotHubManager.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 IotHub service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the IotHub service API instance. + */ + public IotHubManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies + .add( + new UserAgentPolicy( + null, + "com.azure.resourcemanager.iothub", + "1.0.0-beta.1", + Configuration.getGlobalConfiguration())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new IotHubManager(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 IotHubResources. */ + public IotHubResources iotHubResources() { + if (this.iotHubResources == null) { + this.iotHubResources = new IotHubResourcesImpl(clientObject.getIotHubResources(), this); + } + return iotHubResources; + } + + /** @return Resource collection API of ResourceProviderCommons. */ + public ResourceProviderCommons resourceProviderCommons() { + if (this.resourceProviderCommons == null) { + this.resourceProviderCommons = + new ResourceProviderCommonsImpl(clientObject.getResourceProviderCommons(), this); + } + return resourceProviderCommons; + } + + /** @return Resource collection API of Certificates. */ + public Certificates certificates() { + if (this.certificates == null) { + this.certificates = new CertificatesImpl(clientObject.getCertificates(), this); + } + return certificates; + } + + /** @return Resource collection API of IotHubs. */ + public IotHubs iotHubs() { + if (this.iotHubs == null) { + this.iotHubs = new IotHubsImpl(clientObject.getIotHubs(), this); + } + return iotHubs; + } + + /** @return Resource collection API of PrivateLinkResourcesOperations. */ + public PrivateLinkResourcesOperations privateLinkResourcesOperations() { + if (this.privateLinkResourcesOperations == null) { + this.privateLinkResourcesOperations = + new PrivateLinkResourcesOperationsImpl(clientObject.getPrivateLinkResourcesOperations(), this); + } + return privateLinkResourcesOperations; + } + + /** @return Resource collection API of PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * @return Wrapped service client IotHubClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public IotHubClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/CertificatesClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/CertificatesClient.java new file mode 100644 index 0000000000000..bc2ca2a5e211d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/CertificatesClient.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.fluent.models.CertificateDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.CertificateWithNonceDescriptionInner; +import com.azure.resourcemanager.iothub.models.CertificateVerificationDescription; + +/** An instance of this class provides access to all the operations defined in CertificatesClient. */ +public interface CertificatesClient { + /** + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 JSON-serialized array of Certificate objects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateListDescriptionInner listByIotHub(String resourceGroupName, String resourceName); + + /** + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 JSON-serialized array of Certificate objects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByIotHubWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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) + CertificateDescriptionInner get(String resourceGroupName, String resourceName, String certificateName); + + /** + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 getWithResponse( + String resourceGroupName, String resourceName, String certificateName, Context context); + + /** + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param certificateDescription The certificate body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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) + CertificateDescriptionInner createOrUpdate( + String resourceGroupName, + String resourceName, + String certificateName, + CertificateDescriptionInner certificateDescription); + + /** + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update + * an existing certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 resourceName, + String certificateName, + CertificateDescriptionInner certificateDescription, + String ifMatch, + Context context); + + /** + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 resourceName, String certificateName, String ifMatch); + + /** + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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.iothub.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 resourceName, String certificateName, String ifMatch, Context context); + + /** + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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) + CertificateWithNonceDescriptionInner generateVerificationCode( + String resourceGroupName, String resourceName, String certificateName, String ifMatch); + + /** + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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.iothub.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 generateVerificationCodeWithResponse( + String resourceGroupName, String resourceName, String certificateName, String ifMatch, Context context); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @param certificateVerificationBody The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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) + CertificateDescriptionInner verify( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @param certificateVerificationBody The name of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 verifyWithResponse( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody, + Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubClient.java new file mode 100644 index 0000000000000..1b9e4e0df543c --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubClient.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for IotHubClient class. */ +public interface IotHubClient { + /** + * 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 IotHubResourcesClient object to access its operations. + * + * @return the IotHubResourcesClient object. + */ + IotHubResourcesClient getIotHubResources(); + + /** + * Gets the ResourceProviderCommonsClient object to access its operations. + * + * @return the ResourceProviderCommonsClient object. + */ + ResourceProviderCommonsClient getResourceProviderCommons(); + + /** + * Gets the CertificatesClient object to access its operations. + * + * @return the CertificatesClient object. + */ + CertificatesClient getCertificates(); + + /** + * Gets the IotHubsClient object to access its operations. + * + * @return the IotHubsClient object. + */ + IotHubsClient getIotHubs(); + + /** + * Gets the PrivateLinkResourcesOperationsClient object to access its operations. + * + * @return the PrivateLinkResourcesOperationsClient object. + */ + PrivateLinkResourcesOperationsClient getPrivateLinkResourcesOperations(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java new file mode 100644 index 0000000000000..5213c706fc68d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java @@ -0,0 +1,912 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.fluent.models.EndpointHealthDataInner; +import com.azure.resourcemanager.iothub.fluent.models.EventHubConsumerGroupInfoInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubNameAvailabilityInfoInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubQuotaMetricInfoInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubSkuDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.JobResponseInner; +import com.azure.resourcemanager.iothub.fluent.models.RegistryStatisticsInner; +import com.azure.resourcemanager.iothub.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.azure.resourcemanager.iothub.fluent.models.TestAllRoutesResultInner; +import com.azure.resourcemanager.iothub.fluent.models.TestRouteResultInner; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupBodyDescription; +import com.azure.resourcemanager.iothub.models.ExportDevicesRequest; +import com.azure.resourcemanager.iothub.models.ImportDevicesRequest; +import com.azure.resourcemanager.iothub.models.OperationInputs; +import com.azure.resourcemanager.iothub.models.TagsResource; +import com.azure.resourcemanager.iothub.models.TestAllRoutesInput; +import com.azure.resourcemanager.iothub.models.TestRouteInput; + +/** An instance of this class provides access to all the operations defined in IotHubResourcesClient. */ +public interface IotHubResourcesClient { + /** + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 non-security related metadata of an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotHubDescriptionInner getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 non-security related metadata of an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, IotHubDescriptionInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch); + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, IotHubDescriptionInner> beginCreateOrUpdate( + String resourceGroupName, + String resourceName, + IotHubDescriptionInner iotHubDescription, + String ifMatch, + Context context); + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotHubDescriptionInner createOrUpdate( + String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch); + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotHubDescriptionInner createOrUpdate( + String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription); + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotHubDescriptionInner createOrUpdate( + String resourceGroupName, + String resourceName, + IotHubDescriptionInner iotHubDescription, + String ifMatch, + Context context); + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, IotHubDescriptionInner> beginUpdate( + String resourceGroupName, String resourceName, TagsResource iotHubTags); + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, IotHubDescriptionInner> beginUpdate( + String resourceGroupName, String resourceName, TagsResource iotHubTags, Context context); + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotHubDescriptionInner update(String resourceGroupName, String resourceName, TagsResource iotHubTags); + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotHubDescriptionInner update( + String resourceGroupName, String resourceName, TagsResource iotHubTags, Context context); + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, IotHubDescriptionInner> beginDelete( + String resourceGroupName, String resourceName); + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, IotHubDescriptionInner> beginDelete( + String resourceGroupName, String resourceName, Context context); + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotHubDescriptionInner delete(String resourceGroupName, String resourceName); + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotHubDescriptionInner delete(String resourceGroupName, String resourceName, Context context); + + /** + * Get all the IoT hubs in a subscription. + * + * @throws com.azure.resourcemanager.iothub.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 IoT hubs in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get all the IoT hubs in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hubs in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hubs in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hubs in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 statistics from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistryStatisticsInner getStats(String resourceGroupName, String resourceName); + + /** + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 statistics from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getStatsWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getValidSkus(String resourceGroupName, String resourceName); + + /** + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getValidSkus( + String resourceGroupName, String resourceName, Context context); + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listEventHubConsumerGroups( + String resourceGroupName, String resourceName, String eventHubEndpointName); + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listEventHubConsumerGroups( + String resourceGroupName, String resourceName, String eventHubEndpointName, Context context); + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventHubConsumerGroupInfoInner getEventHubConsumerGroup( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name); + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getEventHubConsumerGroupWithResponse( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context); + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties of the EventHubConsumerGroupInfo object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventHubConsumerGroupInfoInner createEventHubConsumerGroup( + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody); + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties of the EventHubConsumerGroupInfo object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createEventHubConsumerGroupWithResponse( + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody, + Context context); + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 deleteEventHubConsumerGroup( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name); + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 deleteEventHubConsumerGroupWithResponse( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context); + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 the jobs in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listJobs(String resourceGroupName, String resourceName); + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 the jobs in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listJobs(String resourceGroupName, String resourceName, Context context); + + /** + * Get the details of a job from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 details of a job from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobResponseInner getJob(String resourceGroupName, String resourceName, String jobId); + + /** + * Get the details of a job from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 details of a job from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getJobWithResponse( + String resourceGroupName, String resourceName, String jobId, Context context); + + /** + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 quota metrics for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getQuotaMetrics(String resourceGroupName, String resourceName); + + /** + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 quota metrics for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getQuotaMetrics( + String resourceGroupName, String resourceName, Context context); + + /** + * Get the health for routing endpoints. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param iotHubName The iotHubName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 health for routing endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getEndpointHealth(String resourceGroupName, String iotHubName); + + /** + * Get the health for routing endpoints. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param iotHubName The iotHubName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 health for routing endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getEndpointHealth( + String resourceGroupName, String iotHubName, Context context); + + /** + * Check if an IoT hub name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT hub to + * check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties indicating whether a given IoT hub name is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IotHubNameAvailabilityInfoInner checkNameAvailability(OperationInputs operationInputs); + + /** + * Check if an IoT hub name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT hub to + * check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties indicating whether a given IoT hub name is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + OperationInputs operationInputs, Context context); + + /** + * Test all routes configured in this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Input for testing all routes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 testing all routes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestAllRoutesResultInner testAllRoutes(String iotHubName, String resourceGroupName, TestAllRoutesInput input); + + /** + * Test all routes configured in this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Input for testing all routes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 testing all routes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response testAllRoutesWithResponse( + String iotHubName, String resourceGroupName, TestAllRoutesInput input, Context context); + + /** + * Test the new route for this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Route that needs to be tested. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 testing one route. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestRouteResultInner testRoute(String iotHubName, String resourceGroupName, TestRouteInput input); + + /** + * Test the new route for this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Route that needs to be tested. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 testing one route. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response testRouteWithResponse( + String iotHubName, String resourceGroupName, TestRouteInput input, Context context); + + /** + * Get the security metadata for an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 security metadata for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listKeys(String resourceGroupName, String resourceName); + + /** + * Get the security metadata for an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 security metadata for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listKeys( + String resourceGroupName, String resourceName, Context context); + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 shared access policy by name from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedAccessSignatureAuthorizationRuleInner getKeysForKeyName( + String resourceGroupName, String resourceName, String keyName); + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 shared access policy by name from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getKeysForKeyNameWithResponse( + String resourceGroupName, String resourceName, String keyName, Context context); + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more + * information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobResponseInner exportDevices( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters); + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more + * information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportDevicesWithResponse( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters, Context context); + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobResponseInner importDevices( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters); + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response importDevicesWithResponse( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters, Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubsClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubsClient.java new file mode 100644 index 0000000000000..70bc77d461df8 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubsClient.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.iothub.models.FailoverInput; + +/** An instance of this class provides access to all the operations defined in IotHubsClient. */ +public interface IotHubsClient { + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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> beginManualFailover( + String iotHubName, String resourceGroupName, FailoverInput failoverInput); + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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> beginManualFailover( + String iotHubName, String resourceGroupName, FailoverInput failoverInput, Context context); + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 manualFailover(String iotHubName, String resourceGroupName, FailoverInput failoverInput); + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 manualFailover(String iotHubName, String resourceGroupName, FailoverInput failoverInput, Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/OperationsClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/OperationsClient.java new file mode 100644 index 0000000000000..c404a7b96c1b4 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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.iothub.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 IoT Hub REST API operations. + * + * @throws com.azure.resourcemanager.iothub.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 IoT Hub operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available IoT Hub REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT Hub operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/PrivateEndpointConnectionsClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..7563b1837ebf7 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.iothub.fluent.models.PrivateEndpointConnectionInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List list(String resourceGroupName, String resourceName); + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 get( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 getWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginUpdate( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginUpdate( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context); + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner update( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner update( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginDelete( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginDelete( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner delete( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner delete( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/PrivateLinkResourcesOperationsClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/PrivateLinkResourcesOperationsClient.java new file mode 100644 index 0000000000000..e9cdb4579ff57 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/PrivateLinkResourcesOperationsClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.iothub.fluent.models.PrivateLinkResourcesInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesOperationsClient. */ +public interface PrivateLinkResourcesOperationsClient { + /** + * List private link resources for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourcesInner list(String resourceGroupName, String resourceName); + + /** + * List private link resources for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get the specified private link resource for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupIdInformationInner get(String resourceGroupName, String resourceName, String groupId); + + /** + * Get the specified private link resource for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/ResourceProviderCommonsClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/ResourceProviderCommonsClient.java new file mode 100644 index 0000000000000..942cd190969bf --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/ResourceProviderCommonsClient.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.iothub.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.iothub.fluent.models.UserSubscriptionQuotaListResultInner; + +/** An instance of this class provides access to all the operations defined in ResourceProviderCommonsClient. */ +public interface ResourceProviderCommonsClient { + /** + * Get the number of free and paid iot hubs in the subscription. + * + * @throws com.azure.resourcemanager.iothub.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 number of free and paid iot hubs in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UserSubscriptionQuotaListResultInner getSubscriptionQuota(); + + /** + * Get the number of free and paid iot hubs in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 number of free and paid iot hubs in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSubscriptionQuotaWithResponse(Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/CertificateDescriptionInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/CertificateDescriptionInner.java new file mode 100644 index 0000000000000..4e3667bc34952 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/CertificateDescriptionInner.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.iothub.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.iothub.models.CertificateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The X509 Certificate. */ +@Fluent +public final class CertificateDescriptionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateDescriptionInner.class); + + /* + * The description of an X509 CA 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: The description of an X509 CA Certificate. + * + * @return the properties value. + */ + public CertificateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The description of an X509 CA Certificate. + * + * @param properties the properties value to set. + * @return the CertificateDescriptionInner object itself. + */ + public CertificateDescriptionInner 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/CertificateListDescriptionInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/CertificateListDescriptionInner.java new file mode 100644 index 0000000000000..6ec54577bdd99 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/CertificateWithNonceDescriptionInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/CertificateWithNonceDescriptionInner.java new file mode 100644 index 0000000000000..872bcaa040a4f --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/CertificateWithNonceDescriptionInner.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.models.CertificatePropertiesWithNonce; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The X509 Certificate. */ +@Fluent +public final class CertificateWithNonceDescriptionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateWithNonceDescriptionInner.class); + + /* + * The description of an X509 CA Certificate including the challenge nonce + * issued for the Proof-Of-Possession flow. + */ + @JsonProperty(value = "properties") + private CertificatePropertiesWithNonce properties; + + /* + * The entity tag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the properties property: The description of an X509 CA Certificate including the challenge nonce issued for + * the Proof-Of-Possession flow. + * + * @return the properties value. + */ + public CertificatePropertiesWithNonce properties() { + return this.properties; + } + + /** + * Set the properties property: The description of an X509 CA Certificate including the challenge nonce issued for + * the Proof-Of-Possession flow. + * + * @param properties the properties value to set. + * @return the CertificateWithNonceDescriptionInner object itself. + */ + public CertificateWithNonceDescriptionInner withProperties(CertificatePropertiesWithNonce 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/EndpointHealthDataInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/EndpointHealthDataInner.java new file mode 100644 index 0000000000000..2091a2c740a4f --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/EndpointHealthDataInner.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.EndpointHealthStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The health data for an endpoint. */ +@Fluent +public final class EndpointHealthDataInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EndpointHealthDataInner.class); + + /* + * Id of the endpoint + */ + @JsonProperty(value = "endpointId") + private String endpointId; + + /* + * Health statuses have following meanings. The 'healthy' status shows that + * the endpoint is accepting messages as expected. The 'unhealthy' status + * shows that the endpoint is not accepting messages as expected and IoT + * Hub is retrying to send data to this endpoint. The status of an + * unhealthy endpoint will be updated to healthy when IoT Hub has + * established an eventually consistent state of health. The 'dead' status + * shows that the endpoint is not accepting messages, after IoT Hub retried + * sending messages for the retrial period. See IoT Hub metrics to identify + * errors and monitor issues with endpoints. The 'unknown' status shows + * that the IoT Hub has not established a connection with the endpoint. No + * messages have been delivered to or rejected from this endpoint + */ + @JsonProperty(value = "healthStatus") + private EndpointHealthStatus healthStatus; + + /* + * Last error obtained when a message failed to be delivered to iot hub + */ + @JsonProperty(value = "lastKnownError") + private String lastKnownError; + + /* + * Time at which the last known error occurred + */ + @JsonProperty(value = "lastKnownErrorTime") + private DateTimeRfc1123 lastKnownErrorTime; + + /* + * Last time iot hub successfully sent a message to the endpoint + */ + @JsonProperty(value = "lastSuccessfulSendAttemptTime") + private DateTimeRfc1123 lastSuccessfulSendAttemptTime; + + /* + * Last time iot hub tried to send a message to the endpoint + */ + @JsonProperty(value = "lastSendAttemptTime") + private DateTimeRfc1123 lastSendAttemptTime; + + /** + * Get the endpointId property: Id of the endpoint. + * + * @return the endpointId value. + */ + public String endpointId() { + return this.endpointId; + } + + /** + * Set the endpointId property: Id of the endpoint. + * + * @param endpointId the endpointId value to set. + * @return the EndpointHealthDataInner object itself. + */ + public EndpointHealthDataInner withEndpointId(String endpointId) { + this.endpointId = endpointId; + return this; + } + + /** + * Get the healthStatus property: Health statuses have following meanings. The 'healthy' status shows that the + * endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint is not accepting + * messages as expected and IoT Hub is retrying to send data to this endpoint. The status of an unhealthy endpoint + * will be updated to healthy when IoT Hub has established an eventually consistent state of health. The 'dead' + * status shows that the endpoint is not accepting messages, after IoT Hub retried sending messages for the retrial + * period. See IoT Hub metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + * the IoT Hub has not established a connection with the endpoint. No messages have been delivered to or rejected + * from this endpoint. + * + * @return the healthStatus value. + */ + public EndpointHealthStatus healthStatus() { + return this.healthStatus; + } + + /** + * Set the healthStatus property: Health statuses have following meanings. The 'healthy' status shows that the + * endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint is not accepting + * messages as expected and IoT Hub is retrying to send data to this endpoint. The status of an unhealthy endpoint + * will be updated to healthy when IoT Hub has established an eventually consistent state of health. The 'dead' + * status shows that the endpoint is not accepting messages, after IoT Hub retried sending messages for the retrial + * period. See IoT Hub metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + * the IoT Hub has not established a connection with the endpoint. No messages have been delivered to or rejected + * from this endpoint. + * + * @param healthStatus the healthStatus value to set. + * @return the EndpointHealthDataInner object itself. + */ + public EndpointHealthDataInner withHealthStatus(EndpointHealthStatus healthStatus) { + this.healthStatus = healthStatus; + return this; + } + + /** + * Get the lastKnownError property: Last error obtained when a message failed to be delivered to iot hub. + * + * @return the lastKnownError value. + */ + public String lastKnownError() { + return this.lastKnownError; + } + + /** + * Set the lastKnownError property: Last error obtained when a message failed to be delivered to iot hub. + * + * @param lastKnownError the lastKnownError value to set. + * @return the EndpointHealthDataInner object itself. + */ + public EndpointHealthDataInner withLastKnownError(String lastKnownError) { + this.lastKnownError = lastKnownError; + return this; + } + + /** + * Get the lastKnownErrorTime property: Time at which the last known error occurred. + * + * @return the lastKnownErrorTime value. + */ + public OffsetDateTime lastKnownErrorTime() { + if (this.lastKnownErrorTime == null) { + return null; + } + return this.lastKnownErrorTime.getDateTime(); + } + + /** + * Set the lastKnownErrorTime property: Time at which the last known error occurred. + * + * @param lastKnownErrorTime the lastKnownErrorTime value to set. + * @return the EndpointHealthDataInner object itself. + */ + public EndpointHealthDataInner withLastKnownErrorTime(OffsetDateTime lastKnownErrorTime) { + if (lastKnownErrorTime == null) { + this.lastKnownErrorTime = null; + } else { + this.lastKnownErrorTime = new DateTimeRfc1123(lastKnownErrorTime); + } + return this; + } + + /** + * Get the lastSuccessfulSendAttemptTime property: Last time iot hub successfully sent a message to the endpoint. + * + * @return the lastSuccessfulSendAttemptTime value. + */ + public OffsetDateTime lastSuccessfulSendAttemptTime() { + if (this.lastSuccessfulSendAttemptTime == null) { + return null; + } + return this.lastSuccessfulSendAttemptTime.getDateTime(); + } + + /** + * Set the lastSuccessfulSendAttemptTime property: Last time iot hub successfully sent a message to the endpoint. + * + * @param lastSuccessfulSendAttemptTime the lastSuccessfulSendAttemptTime value to set. + * @return the EndpointHealthDataInner object itself. + */ + public EndpointHealthDataInner withLastSuccessfulSendAttemptTime(OffsetDateTime lastSuccessfulSendAttemptTime) { + if (lastSuccessfulSendAttemptTime == null) { + this.lastSuccessfulSendAttemptTime = null; + } else { + this.lastSuccessfulSendAttemptTime = new DateTimeRfc1123(lastSuccessfulSendAttemptTime); + } + return this; + } + + /** + * Get the lastSendAttemptTime property: Last time iot hub tried to send a message to the endpoint. + * + * @return the lastSendAttemptTime value. + */ + public OffsetDateTime lastSendAttemptTime() { + if (this.lastSendAttemptTime == null) { + return null; + } + return this.lastSendAttemptTime.getDateTime(); + } + + /** + * Set the lastSendAttemptTime property: Last time iot hub tried to send a message to the endpoint. + * + * @param lastSendAttemptTime the lastSendAttemptTime value to set. + * @return the EndpointHealthDataInner object itself. + */ + public EndpointHealthDataInner withLastSendAttemptTime(OffsetDateTime lastSendAttemptTime) { + if (lastSendAttemptTime == null) { + this.lastSendAttemptTime = null; + } else { + this.lastSendAttemptTime = new DateTimeRfc1123(lastSendAttemptTime); + } + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/EventHubConsumerGroupInfoInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/EventHubConsumerGroupInfoInner.java new file mode 100644 index 0000000000000..95e4261c931e3 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/EventHubConsumerGroupInfoInner.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.iothub.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The properties of the EventHubConsumerGroupInfo object. */ +@Fluent +public final class EventHubConsumerGroupInfoInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EventHubConsumerGroupInfoInner.class); + + /* + * The tags. + */ + @JsonProperty(value = "properties") + private Map properties; + + /* + * The etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the properties property: The tags. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties property: The tags. + * + * @param properties the properties value to set. + * @return the EventHubConsumerGroupInfoInner object itself. + */ + public EventHubConsumerGroupInfoInner withProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Get the etag property: The etag. + * + * @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() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/GroupIdInformationInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/GroupIdInformationInner.java new file mode 100644 index 0000000000000..69ec9283f78c8 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.GroupIdInformationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The group information for creating a private endpoint on an IotHub. */ +@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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubDescriptionInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubDescriptionInner.java new file mode 100644 index 0000000000000..4eebe4e0ddf75 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubDescriptionInner.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.models.IotHubProperties; +import com.azure.resourcemanager.iothub.models.IotHubSkuInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The description of the IoT hub. */ +@Fluent +public final class IotHubDescriptionInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubDescriptionInner.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; + + /* + * IotHub properties + */ + @JsonProperty(value = "properties") + private IotHubProperties properties; + + /* + * IotHub SKU info + */ + @JsonProperty(value = "sku", required = true) + private IotHubSkuInfo sku; + + /** + * 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 IotHubDescriptionInner object itself. + */ + public IotHubDescriptionInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the properties property: IotHub properties. + * + * @return the properties value. + */ + public IotHubProperties properties() { + return this.properties; + } + + /** + * Set the properties property: IotHub properties. + * + * @param properties the properties value to set. + * @return the IotHubDescriptionInner object itself. + */ + public IotHubDescriptionInner withProperties(IotHubProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku property: IotHub SKU info. + * + * @return the sku value. + */ + public IotHubSkuInfo sku() { + return this.sku; + } + + /** + * Set the sku property: IotHub SKU info. + * + * @param sku the sku value to set. + * @return the IotHubDescriptionInner object itself. + */ + public IotHubDescriptionInner withSku(IotHubSkuInfo sku) { + this.sku = sku; + return this; + } + + /** {@inheritDoc} */ + @Override + public IotHubDescriptionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public IotHubDescriptionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (sku() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property sku in model IotHubDescriptionInner")); + } else { + sku().validate(); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubNameAvailabilityInfoInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubNameAvailabilityInfoInner.java new file mode 100644 index 0000000000000..290637ad21501 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubNameAvailabilityInfoInner.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.IotHubNameUnavailabilityReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties indicating whether a given IoT hub name is available. */ +@Fluent +public final class IotHubNameAvailabilityInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubNameAvailabilityInfoInner.class); + + /* + * The value which indicates whether the provided name is available. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /* + * The reason for unavailability. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private IotHubNameUnavailabilityReason reason; + + /* + * The detailed reason message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable property: The value which indicates whether the provided name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: The reason for unavailability. + * + * @return the reason value. + */ + public IotHubNameUnavailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: The detailed reason message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The detailed reason message. + * + * @param message the message value to set. + * @return the IotHubNameAvailabilityInfoInner object itself. + */ + public IotHubNameAvailabilityInfoInner 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubQuotaMetricInfoInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubQuotaMetricInfoInner.java new file mode 100644 index 0000000000000..e82c4fb87f8b5 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubQuotaMetricInfoInner.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.iothub.fluent.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; + +/** Quota metrics properties. */ +@Immutable +public final class IotHubQuotaMetricInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubQuotaMetricInfoInner.class); + + /* + * The name of the quota metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The current value for the quota metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Long currentValue; + + /* + * The maximum value of the quota metric. + */ + @JsonProperty(value = "maxValue", access = JsonProperty.Access.WRITE_ONLY) + private Long maxValue; + + /** + * Get the name property: The name of the quota metric. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the currentValue property: The current value for the quota metric. + * + * @return the currentValue value. + */ + public Long currentValue() { + return this.currentValue; + } + + /** + * Get the maxValue property: The maximum value of the quota metric. + * + * @return the maxValue value. + */ + public Long maxValue() { + return this.maxValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubSkuDescriptionInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubSkuDescriptionInner.java new file mode 100644 index 0000000000000..72e8ad5a00c6e --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubSkuDescriptionInner.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.IotHubCapacity; +import com.azure.resourcemanager.iothub.models.IotHubSkuInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** SKU properties. */ +@Fluent +public final class IotHubSkuDescriptionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubSkuDescriptionInner.class); + + /* + * The type of the resource. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /* + * The type of the resource. + */ + @JsonProperty(value = "sku", required = true) + private IotHubSkuInfo sku; + + /* + * IotHub capacity + */ + @JsonProperty(value = "capacity", required = true) + private IotHubCapacity capacity; + + /** + * Get the resourceType property: The type of the resource. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the sku property: The type of the resource. + * + * @return the sku value. + */ + public IotHubSkuInfo sku() { + return this.sku; + } + + /** + * Set the sku property: The type of the resource. + * + * @param sku the sku value to set. + * @return the IotHubSkuDescriptionInner object itself. + */ + public IotHubSkuDescriptionInner withSku(IotHubSkuInfo sku) { + this.sku = sku; + return this; + } + + /** + * Get the capacity property: IotHub capacity. + * + * @return the capacity value. + */ + public IotHubCapacity capacity() { + return this.capacity; + } + + /** + * Set the capacity property: IotHub capacity. + * + * @param capacity the capacity value to set. + * @return the IotHubSkuDescriptionInner object itself. + */ + public IotHubSkuDescriptionInner withCapacity(IotHubCapacity capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property sku in model IotHubSkuDescriptionInner")); + } else { + sku().validate(); + } + if (capacity() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property capacity in model IotHubSkuDescriptionInner")); + } else { + capacity().validate(); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/JobResponseInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/JobResponseInner.java new file mode 100644 index 0000000000000..14c7771996198 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/JobResponseInner.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.JobStatus; +import com.azure.resourcemanager.iothub.models.JobType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of the Job Response object. */ +@Immutable +public final class JobResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobResponseInner.class); + + /* + * The job identifier. + */ + @JsonProperty(value = "jobId", access = JsonProperty.Access.WRITE_ONLY) + private String jobId; + + /* + * The start time of the job. + */ + @JsonProperty(value = "startTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 startTimeUtc; + + /* + * The time the job stopped processing. + */ + @JsonProperty(value = "endTimeUtc", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 endTimeUtc; + + /* + * The type of the job. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private JobType type; + + /* + * The status of the job. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private JobStatus status; + + /* + * If status == failed, this string containing the reason for the failure. + */ + @JsonProperty(value = "failureReason", access = JsonProperty.Access.WRITE_ONLY) + private String failureReason; + + /* + * The status message for the job. + */ + @JsonProperty(value = "statusMessage", access = JsonProperty.Access.WRITE_ONLY) + private String statusMessage; + + /* + * The job identifier of the parent job, if any. + */ + @JsonProperty(value = "parentJobId", access = JsonProperty.Access.WRITE_ONLY) + private String parentJobId; + + /** + * Get the jobId property: The job identifier. + * + * @return the jobId value. + */ + public String jobId() { + return this.jobId; + } + + /** + * Get the startTimeUtc property: The start time of the job. + * + * @return the startTimeUtc value. + */ + public OffsetDateTime startTimeUtc() { + if (this.startTimeUtc == null) { + return null; + } + return this.startTimeUtc.getDateTime(); + } + + /** + * Get the endTimeUtc property: The time the job stopped processing. + * + * @return the endTimeUtc value. + */ + public OffsetDateTime endTimeUtc() { + if (this.endTimeUtc == null) { + return null; + } + return this.endTimeUtc.getDateTime(); + } + + /** + * Get the type property: The type of the job. + * + * @return the type value. + */ + public JobType type() { + return this.type; + } + + /** + * Get the status property: The status of the job. + * + * @return the status value. + */ + public JobStatus status() { + return this.status; + } + + /** + * Get the failureReason property: If status == failed, this string containing the reason for the failure. + * + * @return the failureReason value. + */ + public String failureReason() { + return this.failureReason; + } + + /** + * Get the statusMessage property: The status message for the job. + * + * @return the statusMessage value. + */ + public String statusMessage() { + return this.statusMessage; + } + + /** + * Get the parentJobId property: The job identifier of the parent job, if any. + * + * @return the parentJobId value. + */ + public String parentJobId() { + return this.parentJobId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/OperationInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..81b5caab0d88a --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** IoT Hub 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/PrivateEndpointConnectionInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..57368cce98007 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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.iothub.models.PrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private endpoint connection of an IotHub. */ +@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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/PrivateLinkResourcesInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/PrivateLinkResourcesInner.java new file mode 100644 index 0000000000000..5516fc45a2d5d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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 an IotHub. */ +@Fluent +public final class PrivateLinkResourcesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesInner.class); + + /* + * The list of available private link resources for an IotHub + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of available private link resources for an IotHub. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of available private link resources for an IotHub. + * + * @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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/RegistryStatisticsInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/RegistryStatisticsInner.java new file mode 100644 index 0000000000000..15d0c948a8f7b --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/RegistryStatisticsInner.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.iothub.fluent.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; + +/** Identity registry statistics. */ +@Immutable +public final class RegistryStatisticsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistryStatisticsInner.class); + + /* + * The total count of devices in the identity registry. + */ + @JsonProperty(value = "totalDeviceCount", access = JsonProperty.Access.WRITE_ONLY) + private Long totalDeviceCount; + + /* + * The count of enabled devices in the identity registry. + */ + @JsonProperty(value = "enabledDeviceCount", access = JsonProperty.Access.WRITE_ONLY) + private Long enabledDeviceCount; + + /* + * The count of disabled devices in the identity registry. + */ + @JsonProperty(value = "disabledDeviceCount", access = JsonProperty.Access.WRITE_ONLY) + private Long disabledDeviceCount; + + /** + * Get the totalDeviceCount property: The total count of devices in the identity registry. + * + * @return the totalDeviceCount value. + */ + public Long totalDeviceCount() { + return this.totalDeviceCount; + } + + /** + * Get the enabledDeviceCount property: The count of enabled devices in the identity registry. + * + * @return the enabledDeviceCount value. + */ + public Long enabledDeviceCount() { + return this.enabledDeviceCount; + } + + /** + * Get the disabledDeviceCount property: The count of disabled devices in the identity registry. + * + * @return the disabledDeviceCount value. + */ + public Long disabledDeviceCount() { + return this.disabledDeviceCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/SharedAccessSignatureAuthorizationRuleInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/SharedAccessSignatureAuthorizationRuleInner.java new file mode 100644 index 0000000000000..86a4837904c87 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/SharedAccessSignatureAuthorizationRuleInner.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.AccessRights; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an IoT hub shared access policy. */ +@Fluent +public final class SharedAccessSignatureAuthorizationRuleInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedAccessSignatureAuthorizationRuleInner.class); + + /* + * The name of the shared access policy. + */ + @JsonProperty(value = "keyName", required = true) + private String keyName; + + /* + * The primary key. + */ + @JsonProperty(value = "primaryKey") + private String primaryKey; + + /* + * The secondary key. + */ + @JsonProperty(value = "secondaryKey") + private String secondaryKey; + + /* + * The permissions assigned to the shared access policy. + */ + @JsonProperty(value = "rights", required = true) + private AccessRights rights; + + /** + * Get the keyName property: The name of the shared access policy. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: The name of the shared access policy. + * + * @param keyName the keyName value to set. + * @return the SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the primaryKey property: The primary key. + * + * @return the primaryKey value. + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set the primaryKey property: The primary key. + * + * @param primaryKey the primaryKey value to set. + * @return the SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get the secondaryKey property: The secondary key. + * + * @return the secondaryKey value. + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set the secondaryKey property: The secondary key. + * + * @param secondaryKey the secondaryKey value to set. + * @return the SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get the rights property: The permissions assigned to the shared access policy. + * + * @return the rights value. + */ + public AccessRights rights() { + return this.rights; + } + + /** + * Set the rights property: The permissions assigned to the shared access policy. + * + * @param rights the rights value to set. + * @return the SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner withRights(AccessRights 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 SharedAccessSignatureAuthorizationRuleInner")); + } + if (rights() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property rights in model SharedAccessSignatureAuthorizationRuleInner")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/TestAllRoutesResultInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/TestAllRoutesResultInner.java new file mode 100644 index 0000000000000..1c15d09d95c13 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/TestAllRoutesResultInner.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.iothub.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.MatchedRoute; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of testing all routes. */ +@Fluent +public final class TestAllRoutesResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestAllRoutesResultInner.class); + + /* + * JSON-serialized array of matched routes + */ + @JsonProperty(value = "routes") + private List routes; + + /** + * Get the routes property: JSON-serialized array of matched routes. + * + * @return the routes value. + */ + public List routes() { + return this.routes; + } + + /** + * Set the routes property: JSON-serialized array of matched routes. + * + * @param routes the routes value to set. + * @return the TestAllRoutesResultInner object itself. + */ + public TestAllRoutesResultInner withRoutes(List routes) { + this.routes = routes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (routes() != null) { + routes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/TestRouteResultInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/TestRouteResultInner.java new file mode 100644 index 0000000000000..2feeec924d303 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/TestRouteResultInner.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.TestResultStatus; +import com.azure.resourcemanager.iothub.models.TestRouteResultDetails; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Result of testing one route. */ +@Fluent +public final class TestRouteResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestRouteResultInner.class); + + /* + * Result of testing route + */ + @JsonProperty(value = "result") + private TestResultStatus result; + + /* + * Detailed result of testing route + */ + @JsonProperty(value = "details") + private TestRouteResultDetails details; + + /** + * Get the result property: Result of testing route. + * + * @return the result value. + */ + public TestResultStatus result() { + return this.result; + } + + /** + * Set the result property: Result of testing route. + * + * @param result the result value to set. + * @return the TestRouteResultInner object itself. + */ + public TestRouteResultInner withResult(TestResultStatus result) { + this.result = result; + return this; + } + + /** + * Get the details property: Detailed result of testing route. + * + * @return the details value. + */ + public TestRouteResultDetails details() { + return this.details; + } + + /** + * Set the details property: Detailed result of testing route. + * + * @param details the details value to set. + * @return the TestRouteResultInner object itself. + */ + public TestRouteResultInner withDetails(TestRouteResultDetails details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().validate(); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/UserSubscriptionQuotaListResultInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/UserSubscriptionQuotaListResultInner.java new file mode 100644 index 0000000000000..eae7058bb036d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/UserSubscriptionQuotaListResultInner.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.iothub.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.UserSubscriptionQuota; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Json-serialized array of User subscription quota response. */ +@Fluent +public final class UserSubscriptionQuotaListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserSubscriptionQuotaListResultInner.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The nextLink property. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the UserSubscriptionQuotaListResultInner object itself. + */ + public UserSubscriptionQuotaListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/package-info.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/package-info.java new file mode 100644 index 0000000000000..4fc871e485eb1 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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 IotHubClient. Use this API to manage the IoT hubs in your Azure + * subscription. + */ +package com.azure.resourcemanager.iothub.fluent.models; diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/package-info.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/package-info.java new file mode 100644 index 0000000000000..b0f3951832362 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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 IotHubClient. Use this API to manage the IoT hubs in your Azure + * subscription. + */ +package com.azure.resourcemanager.iothub.fluent; diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateDescriptionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateDescriptionImpl.java new file mode 100644 index 0000000000000..3fffff912317f --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateDescriptionImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner; +import com.azure.resourcemanager.iothub.models.CertificateDescription; +import com.azure.resourcemanager.iothub.models.CertificateProperties; + +public final class CertificateDescriptionImpl + implements CertificateDescription, CertificateDescription.Definition, CertificateDescription.Update { + private CertificateDescriptionInner innerObject; + + private final IotHubManager 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 CertificateDescriptionInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private String certificateName; + + private String createIfMatch; + + private String updateIfMatch; + + public CertificateDescriptionImpl withExistingIotHub(String resourceGroupName, String resourceName) { + this.resourceGroupName = resourceGroupName; + this.resourceName = resourceName; + return this; + } + + public CertificateDescription create() { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .createOrUpdateWithResponse( + resourceGroupName, resourceName, certificateName, this.innerModel(), createIfMatch, Context.NONE) + .getValue(); + return this; + } + + public CertificateDescription create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .createOrUpdateWithResponse( + resourceGroupName, resourceName, certificateName, this.innerModel(), createIfMatch, context) + .getValue(); + return this; + } + + CertificateDescriptionImpl(String name, IotHubManager serviceManager) { + this.innerObject = new CertificateDescriptionInner(); + this.serviceManager = serviceManager; + this.certificateName = name; + this.createIfMatch = null; + } + + public CertificateDescriptionImpl update() { + this.updateIfMatch = null; + return this; + } + + public CertificateDescription apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .createOrUpdateWithResponse( + resourceGroupName, resourceName, certificateName, this.innerModel(), updateIfMatch, Context.NONE) + .getValue(); + return this; + } + + public CertificateDescription apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .createOrUpdateWithResponse( + resourceGroupName, resourceName, certificateName, this.innerModel(), updateIfMatch, context) + .getValue(); + return this; + } + + CertificateDescriptionImpl(CertificateDescriptionInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "IotHubs"); + this.certificateName = Utils.getValueFromIdByName(innerObject.id(), "certificates"); + } + + public CertificateDescription refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .getWithResponse(resourceGroupName, resourceName, certificateName, Context.NONE) + .getValue(); + return this; + } + + public CertificateDescription refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .getWithResponse(resourceGroupName, resourceName, certificateName, context) + .getValue(); + return this; + } + + public CertificateDescriptionImpl withProperties(CertificateProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public CertificateDescriptionImpl 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateListDescriptionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateListDescriptionImpl.java new file mode 100644 index 0000000000000..fb088b0a32e46 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateListDescriptionImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.iothub.models.CertificateDescription; +import com.azure.resourcemanager.iothub.models.CertificateListDescription; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class CertificateListDescriptionImpl implements CertificateListDescription { + private CertificateListDescriptionInner innerObject; + + private final IotHubManager serviceManager; + + CertificateListDescriptionImpl(CertificateListDescriptionInner innerObject, IotHubManager 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 CertificateDescriptionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public CertificateListDescriptionInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateWithNonceDescriptionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateWithNonceDescriptionImpl.java new file mode 100644 index 0000000000000..0376d3e2e301d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateWithNonceDescriptionImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.CertificateWithNonceDescriptionInner; +import com.azure.resourcemanager.iothub.models.CertificatePropertiesWithNonce; +import com.azure.resourcemanager.iothub.models.CertificateWithNonceDescription; + +public final class CertificateWithNonceDescriptionImpl implements CertificateWithNonceDescription { + private CertificateWithNonceDescriptionInner innerObject; + + private final IotHubManager serviceManager; + + CertificateWithNonceDescriptionImpl( + CertificateWithNonceDescriptionInner innerObject, IotHubManager 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 CertificatePropertiesWithNonce properties() { + return this.innerModel().properties(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public CertificateWithNonceDescriptionInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesClientImpl.java new file mode 100644 index 0000000000000..f36c6273e6bc5 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesClientImpl.java @@ -0,0 +1,1322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.CertificatesClient; +import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.CertificateWithNonceDescriptionInner; +import com.azure.resourcemanager.iothub.models.CertificateVerificationDescription; +import com.azure.resourcemanager.iothub.models.ErrorDetailsException; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CertificatesClient. */ +public final class CertificatesClientImpl implements CertificatesClient { + private final ClientLogger logger = new ClientLogger(CertificatesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CertificatesService service; + + /** The service client containing this operation class. */ + private final IotHubClientImpl client; + + /** + * Initializes an instance of CertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CertificatesClientImpl(IotHubClientImpl client) { + this.service = + RestProxy.create(CertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotHubClientCertificates to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotHubClientCertific") + private interface CertificatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/certificates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listByIotHub( + @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/IotHubs" + + "/{resourceName}/certificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("certificateName") String certificateName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/certificates/{certificateName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @BodyParam("application/json") CertificateDescriptionInner certificateDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/certificates/{certificateName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/certificates/{certificateName}/generateVerificationCode") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> generateVerificationCode( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/certificates/{certificateName}/verify") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> verify( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @BodyParam("application/json") CertificateVerificationDescription certificateVerificationBody, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 JSON-serialized array of Certificate objects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByIotHubWithResponseAsync( + 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 + .listByIotHub( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 JSON-serialized array of Certificate objects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByIotHubWithResponseAsync( + 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 + .listByIotHub( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 JSON-serialized array of Certificate objects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByIotHubAsync(String resourceGroupName, String resourceName) { + return listByIotHubWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 JSON-serialized array of Certificate objects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateListDescriptionInner listByIotHub(String resourceGroupName, String resourceName) { + return listByIotHubAsync(resourceGroupName, resourceName).block(); + } + + /** + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 JSON-serialized array of Certificate objects. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByIotHubWithResponse( + String resourceGroupName, String resourceName, Context context) { + return listByIotHubWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName 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> getWithResponseAsync( + String resourceGroupName, String resourceName, String certificateName) { + 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + certificateName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name 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 X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String resourceName, String certificateName, 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + certificateName, + accept, + context); + } + + /** + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName 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 getAsync( + String resourceGroupName, String resourceName, String certificateName) { + return getWithResponseAsync(resourceGroupName, resourceName, certificateName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName 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 CertificateDescriptionInner get(String resourceGroupName, String resourceName, String certificateName) { + return getAsync(resourceGroupName, resourceName, certificateName).block(); + } + + /** + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name 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 X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String resourceName, String certificateName, Context context) { + return getWithResponseAsync(resourceGroupName, resourceName, certificateName, context).block(); + } + + /** + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update + * an existing 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 resourceName, + String certificateName, + CertificateDescriptionInner 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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, + resourceName, + certificateName, + ifMatch, + certificateDescription, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update + * an existing 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 resourceName, + String certificateName, + CertificateDescriptionInner 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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, + resourceName, + certificateName, + ifMatch, + certificateDescription, + accept, + context); + } + + /** + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update + * an existing 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 resourceName, + String certificateName, + CertificateDescriptionInner certificateDescription, + String ifMatch) { + return createOrUpdateWithResponseAsync( + resourceGroupName, resourceName, certificateName, certificateDescription, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 resourceName, + String certificateName, + CertificateDescriptionInner certificateDescription) { + final String ifMatch = null; + return createOrUpdateWithResponseAsync( + resourceGroupName, resourceName, certificateName, certificateDescription, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 CertificateDescriptionInner createOrUpdate( + String resourceGroupName, + String resourceName, + String certificateName, + CertificateDescriptionInner certificateDescription) { + final String ifMatch = null; + return createOrUpdateAsync(resourceGroupName, resourceName, certificateName, certificateDescription, ifMatch) + .block(); + } + + /** + * Adds new or replaces existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update + * an existing 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 resourceName, + String certificateName, + CertificateDescriptionInner certificateDescription, + String ifMatch, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, resourceName, certificateName, certificateDescription, ifMatch, context) + .block(); + } + + /** + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String resourceName, String certificateName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + certificateName, + ifMatch, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String resourceName, String certificateName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + certificateName, + ifMatch, + accept, + context); + } + + /** + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String resourceName, String certificateName, String ifMatch) { + return deleteWithResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName, String certificateName, String ifMatch) { + deleteAsync(resourceGroupName, resourceName, certificateName, ifMatch).block(); + } + + /** + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String resourceName, String certificateName, String ifMatch, Context context) { + return deleteWithResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch, context).block(); + } + + /** + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateVerificationCodeWithResponseAsync( + String resourceGroupName, String resourceName, String certificateName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .generateVerificationCode( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + certificateName, + ifMatch, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateVerificationCodeWithResponseAsync( + String resourceGroupName, String resourceName, String certificateName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generateVerificationCode( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + certificateName, + ifMatch, + accept, + context); + } + + /** + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateVerificationCodeAsync( + String resourceGroupName, String resourceName, String certificateName, String ifMatch) { + return generateVerificationCodeWithResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateWithNonceDescriptionInner generateVerificationCode( + String resourceGroupName, String resourceName, String certificateName, String ifMatch) { + return generateVerificationCodeAsync(resourceGroupName, resourceName, certificateName, ifMatch).block(); + } + + /** + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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 X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateVerificationCodeWithResponse( + String resourceGroupName, String resourceName, String certificateName, String ifMatch, Context context) { + return generateVerificationCodeWithResponseAsync( + resourceGroupName, resourceName, certificateName, ifMatch, context) + .block(); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @param certificateVerificationBody 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> verifyWithResponseAsync( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody) { + 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 (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 (certificateVerificationBody == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter certificateVerificationBody is required and cannot be null.")); + } else { + certificateVerificationBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .verify( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + certificateName, + ifMatch, + certificateVerificationBody, + 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 resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @param certificateVerificationBody The name 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 X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> verifyWithResponseAsync( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody, + 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 (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 (certificateVerificationBody == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter certificateVerificationBody is required and cannot be null.")); + } else { + certificateVerificationBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .verify( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + certificateName, + ifMatch, + certificateVerificationBody, + accept, + context); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @param certificateVerificationBody 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 verifyAsync( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody) { + return verifyWithResponseAsync( + resourceGroupName, resourceName, certificateName, ifMatch, certificateVerificationBody) + .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 resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @param certificateVerificationBody 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 CertificateDescriptionInner verify( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody) { + return verifyAsync(resourceGroupName, resourceName, certificateName, ifMatch, certificateVerificationBody) + .block(); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @param certificateVerificationBody The name 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 X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithResponse( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody, + Context context) { + return verifyWithResponseAsync( + resourceGroupName, resourceName, certificateName, ifMatch, certificateVerificationBody, context) + .block(); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesImpl.java new file mode 100644 index 0000000000000..a77db696aabd6 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesImpl.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.CertificatesClient; +import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.CertificateWithNonceDescriptionInner; +import com.azure.resourcemanager.iothub.models.CertificateDescription; +import com.azure.resourcemanager.iothub.models.CertificateListDescription; +import com.azure.resourcemanager.iothub.models.CertificateVerificationDescription; +import com.azure.resourcemanager.iothub.models.CertificateWithNonceDescription; +import com.azure.resourcemanager.iothub.models.Certificates; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CertificatesImpl implements Certificates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificatesImpl.class); + + private final CertificatesClient innerClient; + + private final IotHubManager serviceManager; + + public CertificatesImpl(CertificatesClient innerClient, IotHubManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CertificateListDescription listByIotHub(String resourceGroupName, String resourceName) { + CertificateListDescriptionInner inner = this.serviceClient().listByIotHub(resourceGroupName, resourceName); + if (inner != null) { + return new CertificateListDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listByIotHubWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().listByIotHubWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateListDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CertificateDescription get(String resourceGroupName, String resourceName, String certificateName) { + CertificateDescriptionInner inner = this.serviceClient().get(resourceGroupName, resourceName, certificateName); + if (inner != null) { + return new CertificateDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String resourceName, String certificateName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, resourceName, certificateName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String resourceName, String certificateName, String ifMatch) { + this.serviceClient().delete(resourceGroupName, resourceName, certificateName, ifMatch); + } + + public Response deleteWithResponse( + String resourceGroupName, String resourceName, String certificateName, String ifMatch, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, resourceName, certificateName, ifMatch, context); + } + + public CertificateWithNonceDescription generateVerificationCode( + String resourceGroupName, String resourceName, String certificateName, String ifMatch) { + CertificateWithNonceDescriptionInner inner = + this.serviceClient().generateVerificationCode(resourceGroupName, resourceName, certificateName, ifMatch); + if (inner != null) { + return new CertificateWithNonceDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response generateVerificationCodeWithResponse( + String resourceGroupName, String resourceName, String certificateName, String ifMatch, Context context) { + Response inner = + this + .serviceClient() + .generateVerificationCodeWithResponse( + resourceGroupName, resourceName, certificateName, ifMatch, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateWithNonceDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CertificateDescription verify( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody) { + CertificateDescriptionInner inner = + this + .serviceClient() + .verify(resourceGroupName, resourceName, certificateName, ifMatch, certificateVerificationBody); + if (inner != null) { + return new CertificateDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response verifyWithResponse( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody, + Context context) { + Response inner = + this + .serviceClient() + .verifyWithResponse( + resourceGroupName, resourceName, certificateName, ifMatch, certificateVerificationBody, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CertificateDescription getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", 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.getWithResponse(resourceGroupName, resourceName, certificateName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", 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.getWithResponse(resourceGroupName, resourceName, certificateName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", 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; + this + .deleteWithResponse(resourceGroupName, resourceName, certificateName, localIfMatch, Context.NONE) + .getValue(); + } + + public Response deleteByIdWithResponse(String id, String ifMatch, 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, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", 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, resourceName, certificateName, ifMatch, context); + } + + private CertificatesClient serviceClient() { + return this.innerClient; + } + + private IotHubManager manager() { + return this.serviceManager; + } + + public CertificateDescriptionImpl define(String name) { + return new CertificateDescriptionImpl(name, this.manager()); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EndpointHealthDataImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EndpointHealthDataImpl.java new file mode 100644 index 0000000000000..c23ce60309115 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EndpointHealthDataImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.EndpointHealthDataInner; +import com.azure.resourcemanager.iothub.models.EndpointHealthData; +import com.azure.resourcemanager.iothub.models.EndpointHealthStatus; +import java.time.OffsetDateTime; + +public final class EndpointHealthDataImpl implements EndpointHealthData { + private EndpointHealthDataInner innerObject; + + private final IotHubManager serviceManager; + + EndpointHealthDataImpl(EndpointHealthDataInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String endpointId() { + return this.innerModel().endpointId(); + } + + public EndpointHealthStatus healthStatus() { + return this.innerModel().healthStatus(); + } + + public String lastKnownError() { + return this.innerModel().lastKnownError(); + } + + public OffsetDateTime lastKnownErrorTime() { + return this.innerModel().lastKnownErrorTime(); + } + + public OffsetDateTime lastSuccessfulSendAttemptTime() { + return this.innerModel().lastSuccessfulSendAttemptTime(); + } + + public OffsetDateTime lastSendAttemptTime() { + return this.innerModel().lastSendAttemptTime(); + } + + public EndpointHealthDataInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EventHubConsumerGroupInfoImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EventHubConsumerGroupInfoImpl.java new file mode 100644 index 0000000000000..659397b9f4483 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EventHubConsumerGroupInfoImpl.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.EventHubConsumerGroupInfoInner; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupBodyDescription; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupInfo; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupName; +import java.util.Collections; +import java.util.Map; + +public final class EventHubConsumerGroupInfoImpl + implements EventHubConsumerGroupInfo, EventHubConsumerGroupInfo.Definition { + private EventHubConsumerGroupInfoInner innerObject; + + private final IotHubManager serviceManager; + + EventHubConsumerGroupInfoImpl(EventHubConsumerGroupInfoInner innerObject, IotHubManager 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 Map properties() { + Map inner = this.innerModel().properties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public EventHubConsumerGroupInfoInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private String eventHubEndpointName; + + private String name; + + private EventHubConsumerGroupBodyDescription createConsumerGroupBody; + + public EventHubConsumerGroupInfoImpl withExistingEventHubEndpoint( + String resourceGroupName, String resourceName, String eventHubEndpointName) { + this.resourceGroupName = resourceGroupName; + this.resourceName = resourceName; + this.eventHubEndpointName = eventHubEndpointName; + return this; + } + + public EventHubConsumerGroupInfo create() { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .createEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, createConsumerGroupBody, Context.NONE) + .getValue(); + return this; + } + + public EventHubConsumerGroupInfo create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .createEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, createConsumerGroupBody, context) + .getValue(); + return this; + } + + EventHubConsumerGroupInfoImpl(String name, IotHubManager serviceManager) { + this.innerObject = new EventHubConsumerGroupInfoInner(); + this.serviceManager = serviceManager; + this.name = name; + this.createConsumerGroupBody = new EventHubConsumerGroupBodyDescription(); + } + + public EventHubConsumerGroupInfo refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .getEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, Context.NONE) + .getValue(); + return this; + } + + public EventHubConsumerGroupInfo refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .getEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, context) + .getValue(); + return this; + } + + public EventHubConsumerGroupInfoImpl withProperties(EventHubConsumerGroupName properties) { + this.createConsumerGroupBody.withProperties(properties); + return this; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/GroupIdInformationImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/GroupIdInformationImpl.java new file mode 100644 index 0000000000000..2a4b7cc3d9db0 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/GroupIdInformationImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.iothub.models.GroupIdInformation; +import com.azure.resourcemanager.iothub.models.GroupIdInformationProperties; + +public final class GroupIdInformationImpl implements GroupIdInformation { + private GroupIdInformationInner innerObject; + + private final IotHubManager serviceManager; + + GroupIdInformationImpl(GroupIdInformationInner innerObject, IotHubManager 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 IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientBuilder.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientBuilder.java new file mode 100644 index 0000000000000..2078371547333 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientBuilder.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.iothub.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 IotHubClientImpl type. */ +@ServiceClientBuilder(serviceClients = {IotHubClientImpl.class}) +public final class IotHubClientBuilder { + /* + * The subscription identifier. + */ + private String subscriptionId; + + /** + * Sets The subscription identifier. + * + * @param subscriptionId the subscriptionId value. + * @return the IotHubClientBuilder. + */ + public IotHubClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the IotHubClientBuilder. + */ + public IotHubClientBuilder 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 IotHubClientBuilder. + */ + public IotHubClientBuilder 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 IotHubClientBuilder. + */ + public IotHubClientBuilder 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 IotHubClientBuilder. + */ + public IotHubClientBuilder 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 IotHubClientBuilder. + */ + public IotHubClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of IotHubClientImpl with the provided parameters. + * + * @return an instance of IotHubClientImpl. + */ + public IotHubClientImpl 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(); + } + IotHubClientImpl client = + new IotHubClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java new file mode 100644 index 0000000000000..589e0bb3e3949 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.fluent.CertificatesClient; +import com.azure.resourcemanager.iothub.fluent.IotHubClient; +import com.azure.resourcemanager.iothub.fluent.IotHubResourcesClient; +import com.azure.resourcemanager.iothub.fluent.IotHubsClient; +import com.azure.resourcemanager.iothub.fluent.OperationsClient; +import com.azure.resourcemanager.iothub.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.iothub.fluent.PrivateLinkResourcesOperationsClient; +import com.azure.resourcemanager.iothub.fluent.ResourceProviderCommonsClient; +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 IotHubClientImpl type. */ +@ServiceClient(builder = IotHubClientBuilder.class) +public final class IotHubClientImpl implements IotHubClient { + private final ClientLogger logger = new ClientLogger(IotHubClientImpl.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 IotHubResourcesClient object to access its operations. */ + private final IotHubResourcesClient iotHubResources; + + /** + * Gets the IotHubResourcesClient object to access its operations. + * + * @return the IotHubResourcesClient object. + */ + public IotHubResourcesClient getIotHubResources() { + return this.iotHubResources; + } + + /** The ResourceProviderCommonsClient object to access its operations. */ + private final ResourceProviderCommonsClient resourceProviderCommons; + + /** + * Gets the ResourceProviderCommonsClient object to access its operations. + * + * @return the ResourceProviderCommonsClient object. + */ + public ResourceProviderCommonsClient getResourceProviderCommons() { + return this.resourceProviderCommons; + } + + /** The CertificatesClient object to access its operations. */ + private final CertificatesClient certificates; + + /** + * Gets the CertificatesClient object to access its operations. + * + * @return the CertificatesClient object. + */ + public CertificatesClient getCertificates() { + return this.certificates; + } + + /** The IotHubsClient object to access its operations. */ + private final IotHubsClient iotHubs; + + /** + * Gets the IotHubsClient object to access its operations. + * + * @return the IotHubsClient object. + */ + public IotHubsClient getIotHubs() { + return this.iotHubs; + } + + /** The PrivateLinkResourcesOperationsClient object to access its operations. */ + private final PrivateLinkResourcesOperationsClient privateLinkResourcesOperations; + + /** + * Gets the PrivateLinkResourcesOperationsClient object to access its operations. + * + * @return the PrivateLinkResourcesOperationsClient object. + */ + public PrivateLinkResourcesOperationsClient getPrivateLinkResourcesOperations() { + return this.privateLinkResourcesOperations; + } + + /** The PrivateEndpointConnectionsClient object to access its operations. */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Initializes an instance of IotHubClient 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. + */ + IotHubClientImpl( + 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-08-31"; + this.operations = new OperationsClientImpl(this); + this.iotHubResources = new IotHubResourcesClientImpl(this); + this.resourceProviderCommons = new ResourceProviderCommonsClientImpl(this); + this.certificates = new CertificatesClientImpl(this); + this.iotHubs = new IotHubsClientImpl(this); + this.privateLinkResourcesOperations = new PrivateLinkResourcesOperationsClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(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 ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubDescriptionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubDescriptionImpl.java new file mode 100644 index 0000000000000..9c74c11bb3a6f --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubDescriptionImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.IotHubDescriptionInner; +import com.azure.resourcemanager.iothub.models.IotHubDescription; +import com.azure.resourcemanager.iothub.models.IotHubProperties; +import com.azure.resourcemanager.iothub.models.IotHubSkuInfo; +import com.azure.resourcemanager.iothub.models.TagsResource; +import java.util.Collections; +import java.util.Map; + +public final class IotHubDescriptionImpl + implements IotHubDescription, IotHubDescription.Definition, IotHubDescription.Update { + private IotHubDescriptionInner innerObject; + + private final IotHubManager 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 IotHubProperties properties() { + return this.innerModel().properties(); + } + + public IotHubSkuInfo sku() { + return this.innerModel().sku(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public IotHubDescriptionInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private String createIfMatch; + + private TagsResource updateIotHubTags; + + public IotHubDescriptionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public IotHubDescription create() { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .createOrUpdate(resourceGroupName, resourceName, this.innerModel(), createIfMatch, Context.NONE); + return this; + } + + public IotHubDescription create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .createOrUpdate(resourceGroupName, resourceName, this.innerModel(), createIfMatch, context); + return this; + } + + IotHubDescriptionImpl(String name, IotHubManager serviceManager) { + this.innerObject = new IotHubDescriptionInner(); + this.serviceManager = serviceManager; + this.resourceName = name; + this.createIfMatch = null; + } + + public IotHubDescriptionImpl update() { + this.updateIotHubTags = new TagsResource(); + return this; + } + + public IotHubDescription apply() { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .update(resourceGroupName, resourceName, updateIotHubTags, Context.NONE); + return this; + } + + public IotHubDescription apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .update(resourceGroupName, resourceName, updateIotHubTags, context); + return this; + } + + IotHubDescriptionImpl(IotHubDescriptionInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "IotHubs"); + } + + public IotHubDescription refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE) + .getValue(); + return this; + } + + public IotHubDescription refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, context) + .getValue(); + return this; + } + + public IotHubDescriptionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public IotHubDescriptionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public IotHubDescriptionImpl withSku(IotHubSkuInfo sku) { + this.innerModel().withSku(sku); + return this; + } + + public IotHubDescriptionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateIotHubTags.withTags(tags); + return this; + } + } + + public IotHubDescriptionImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public IotHubDescriptionImpl withProperties(IotHubProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public IotHubDescriptionImpl withIfMatch(String ifMatch) { + this.createIfMatch = ifMatch; + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubNameAvailabilityInfoImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubNameAvailabilityInfoImpl.java new file mode 100644 index 0000000000000..630ffccd4b67d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubNameAvailabilityInfoImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.IotHubNameAvailabilityInfoInner; +import com.azure.resourcemanager.iothub.models.IotHubNameAvailabilityInfo; +import com.azure.resourcemanager.iothub.models.IotHubNameUnavailabilityReason; + +public final class IotHubNameAvailabilityInfoImpl implements IotHubNameAvailabilityInfo { + private IotHubNameAvailabilityInfoInner innerObject; + + private final IotHubManager serviceManager; + + IotHubNameAvailabilityInfoImpl(IotHubNameAvailabilityInfoInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public IotHubNameUnavailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public IotHubNameAvailabilityInfoInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubQuotaMetricInfoImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubQuotaMetricInfoImpl.java new file mode 100644 index 0000000000000..e42e748285efe --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubQuotaMetricInfoImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.IotHubQuotaMetricInfoInner; +import com.azure.resourcemanager.iothub.models.IotHubQuotaMetricInfo; + +public final class IotHubQuotaMetricInfoImpl implements IotHubQuotaMetricInfo { + private IotHubQuotaMetricInfoInner innerObject; + + private final IotHubManager serviceManager; + + IotHubQuotaMetricInfoImpl(IotHubQuotaMetricInfoInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Long currentValue() { + return this.innerModel().currentValue(); + } + + public Long maxValue() { + return this.innerModel().maxValue(); + } + + public IotHubQuotaMetricInfoInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java new file mode 100644 index 0000000000000..2ec95044ab8de --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java @@ -0,0 +1,5472 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.fluent.IotHubResourcesClient; +import com.azure.resourcemanager.iothub.fluent.models.EndpointHealthDataInner; +import com.azure.resourcemanager.iothub.fluent.models.EventHubConsumerGroupInfoInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubNameAvailabilityInfoInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubQuotaMetricInfoInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubSkuDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.JobResponseInner; +import com.azure.resourcemanager.iothub.fluent.models.RegistryStatisticsInner; +import com.azure.resourcemanager.iothub.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.azure.resourcemanager.iothub.fluent.models.TestAllRoutesResultInner; +import com.azure.resourcemanager.iothub.fluent.models.TestRouteResultInner; +import com.azure.resourcemanager.iothub.models.EndpointHealthDataListResult; +import com.azure.resourcemanager.iothub.models.ErrorDetailsException; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupBodyDescription; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupsListResult; +import com.azure.resourcemanager.iothub.models.ExportDevicesRequest; +import com.azure.resourcemanager.iothub.models.ImportDevicesRequest; +import com.azure.resourcemanager.iothub.models.IotHubDescriptionListResult; +import com.azure.resourcemanager.iothub.models.IotHubQuotaMetricInfoListResult; +import com.azure.resourcemanager.iothub.models.IotHubSkuDescriptionListResult; +import com.azure.resourcemanager.iothub.models.JobResponseListResult; +import com.azure.resourcemanager.iothub.models.OperationInputs; +import com.azure.resourcemanager.iothub.models.SharedAccessSignatureAuthorizationRuleListResult; +import com.azure.resourcemanager.iothub.models.TagsResource; +import com.azure.resourcemanager.iothub.models.TestAllRoutesInput; +import com.azure.resourcemanager.iothub.models.TestRouteInput; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotHubResourcesClient. */ +public final class IotHubResourcesClientImpl implements IotHubResourcesClient { + private final ClientLogger logger = new ClientLogger(IotHubResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotHubResourcesService service; + + /** The service client containing this operation class. */ + private final IotHubClientImpl client; + + /** + * Initializes an instance of IotHubResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotHubResourcesClientImpl(IotHubClientImpl client) { + this.service = + RestProxy.create(IotHubResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotHubClientIotHubResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotHubClientIotHubRe") + private interface IotHubResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getByResourceGroup( + @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"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("If-Match") String ifMatch, + @BodyParam("application/json") IotHubDescriptionInner iotHubDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TagsResource iotHubTags, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}") + @ExpectedResponses({200, 202, 204, 404}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> delete( + @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}/providers/Microsoft.Devices/IotHubs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/IotHubStats") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getStats( + @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/IotHubs" + + "/{resourceName}/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getValidSkus( + @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/IotHubs" + + "/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listEventHubConsumerGroups( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("eventHubEndpointName") String eventHubEndpointName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getEventHubConsumerGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("eventHubEndpointName") String eventHubEndpointName, + @PathParam("name") String name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> createEventHubConsumerGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("eventHubEndpointName") String eventHubEndpointName, + @PathParam("name") String name, + @BodyParam("application/json") EventHubConsumerGroupBodyDescription consumerGroupBody, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> deleteEventHubConsumerGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("eventHubEndpointName") String eventHubEndpointName, + @PathParam("name") String name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/jobs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listJobs( + @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/IotHubs" + + "/{resourceName}/jobs/{jobId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getJob( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("jobId") String jobId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/quotaMetrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getQuotaMetrics( + @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/IotHubs" + + "/{iotHubName}/routingEndpointsHealth") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getEndpointHealth( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("iotHubName") String iotHubName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") OperationInputs operationInputs, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{iotHubName}/routing/routes/$testall") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> testAllRoutes( + @HostParam("$host") String endpoint, + @PathParam("iotHubName") String iotHubName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TestAllRoutesInput input, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{iotHubName}/routing/routes/$testnew") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> testRoute( + @HostParam("$host") String endpoint, + @PathParam("iotHubName") String iotHubName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TestRouteInput input, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/listkeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listKeys( + @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"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/IotHubKeys/{keyName}/listkeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getKeysForKeyName( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("keyName") String keyName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/exportDevices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> exportDevices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") ExportDevicesRequest exportDevicesParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{resourceName}/importDevices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> importDevices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") ImportDevicesRequest importDevicesParameters, + @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> getValidSkusNext( + @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> listEventHubConsumerGroupsNext( + @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> listJobsNext( + @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> getQuotaMetricsNext( + @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> getEndpointHealthNext( + @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 non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 non-security related metadata of an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 non-security related metadata of an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 non-security related metadata of an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 non-security related metadata of an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotHubDescriptionInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupAsync(resourceGroupName, resourceName).block(); + } + + /** + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 non-security related metadata of an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (iotHubDescription == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotHubDescription is required and cannot be null.")); + } else { + iotHubDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + ifMatch, + iotHubDescription, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String resourceName, + IotHubDescriptionInner iotHubDescription, + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (iotHubDescription == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotHubDescription is required and cannot be null.")); + } else { + iotHubDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + ifMatch, + iotHubDescription, + accept, + context); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, IotHubDescriptionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + IotHubDescriptionInner.class, + IotHubDescriptionInner.class, + Context.NONE); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, IotHubDescriptionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String resourceName, + IotHubDescriptionInner iotHubDescription, + String ifMatch, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + IotHubDescriptionInner.class, + IotHubDescriptionInner.class, + context); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, IotHubDescriptionInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).getSyncPoller(); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, IotHubDescriptionInner> beginCreateOrUpdate( + String resourceGroupName, + String resourceName, + IotHubDescriptionInner iotHubDescription, + String ifMatch, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch, context) + .getSyncPoller(); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) { + final String ifMatch = null; + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String resourceName, + IotHubDescriptionInner iotHubDescription, + String ifMatch, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotHubDescriptionInner createOrUpdate( + String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) { + return createOrUpdateAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).block(); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotHubDescriptionInner createOrUpdate( + String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) { + final String ifMatch = null; + return createOrUpdateAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).block(); + } + + /** + * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub + * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT + * hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param iotHubDescription The IoT hub metadata and security metadata. + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an + * existing IoT Hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotHubDescriptionInner createOrUpdate( + String resourceGroupName, + String resourceName, + IotHubDescriptionInner iotHubDescription, + String ifMatch, + Context context) { + return createOrUpdateAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch, context).block(); + } + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String resourceName, TagsResource iotHubTags) { + 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 (iotHubTags == null) { + return Mono.error(new IllegalArgumentException("Parameter iotHubTags is required and cannot be null.")); + } else { + iotHubTags.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + iotHubTags, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String resourceName, TagsResource iotHubTags, 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 (iotHubTags == null) { + return Mono.error(new IllegalArgumentException("Parameter iotHubTags is required and cannot be null.")); + } else { + iotHubTags.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + iotHubTags, + accept, + context); + } + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, IotHubDescriptionInner> beginUpdateAsync( + String resourceGroupName, String resourceName, TagsResource iotHubTags) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, resourceName, iotHubTags); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + IotHubDescriptionInner.class, + IotHubDescriptionInner.class, + Context.NONE); + } + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, IotHubDescriptionInner> beginUpdateAsync( + String resourceGroupName, String resourceName, TagsResource iotHubTags, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, resourceName, iotHubTags, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + IotHubDescriptionInner.class, + IotHubDescriptionInner.class, + context); + } + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, IotHubDescriptionInner> beginUpdate( + String resourceGroupName, String resourceName, TagsResource iotHubTags) { + return beginUpdateAsync(resourceGroupName, resourceName, iotHubTags).getSyncPoller(); + } + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, IotHubDescriptionInner> beginUpdate( + String resourceGroupName, String resourceName, TagsResource iotHubTags, Context context) { + return beginUpdateAsync(resourceGroupName, resourceName, iotHubTags, context).getSyncPoller(); + } + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, TagsResource iotHubTags) { + return beginUpdateAsync(resourceGroupName, resourceName, iotHubTags) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, TagsResource iotHubTags, Context context) { + return beginUpdateAsync(resourceGroupName, resourceName, iotHubTags, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotHubDescriptionInner update(String resourceGroupName, String resourceName, TagsResource iotHubTags) { + return updateAsync(resourceGroupName, resourceName, iotHubTags).block(); + } + + /** + * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param resourceName Name of iot hub to update. + * @param iotHubTags Updated tag information to set into the iot hub 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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotHubDescriptionInner update( + String resourceGroupName, String resourceName, TagsResource iotHubTags, Context context) { + return updateAsync(resourceGroupName, resourceName, iotHubTags, context).block(); + } + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, IotHubDescriptionInner> beginDeleteAsync( + String resourceGroupName, String resourceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + IotHubDescriptionInner.class, + IotHubDescriptionInner.class, + Context.NONE); + } + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, IotHubDescriptionInner> beginDeleteAsync( + String resourceGroupName, String resourceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + IotHubDescriptionInner.class, + IotHubDescriptionInner.class, + context); + } + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, IotHubDescriptionInner> beginDelete( + String resourceGroupName, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceName).getSyncPoller(); + } + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, IotHubDescriptionInner> beginDelete( + String resourceGroupName, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context).getSyncPoller(); + } + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotHubDescriptionInner delete(String resourceGroupName, String resourceName) { + return deleteAsync(resourceGroupName, resourceName).block(); + } + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotHubDescriptionInner delete(String resourceGroupName, String resourceName, Context context) { + return deleteAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @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 IoT hubs in a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + 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 all the IoT hubs in a subscription. + * + * @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 IoT hubs in a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @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 IoT hubs in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @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 IoT hubs in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @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 IoT hubs in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get all the IoT hubs in a subscription. + * + * @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 IoT hubs in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @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 IoT hubs in a 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + 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 all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @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 IoT hubs in a 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @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 IoT hubs in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @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 IoT hubs in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @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 IoT hubs in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @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 IoT hubs in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 statistics from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getStatsWithResponseAsync( + 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 + .getStats( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 statistics from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getStatsWithResponseAsync( + 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 + .getStats( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 statistics from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getStatsAsync(String resourceGroupName, String resourceName) { + return getStatsWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 statistics from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegistryStatisticsInner getStats(String resourceGroupName, String resourceName) { + return getStatsAsync(resourceGroupName, resourceName).block(); + } + + /** + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 statistics from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getStatsWithResponse( + String resourceGroupName, String resourceName, Context context) { + return getStatsWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getValidSkusSinglePageAsync( + 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 + .getValidSkus( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + 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 list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getValidSkusSinglePageAsync( + 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 + .getValidSkus( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getValidSkusAsync(String resourceGroupName, String resourceName) { + return new PagedFlux<>( + () -> getValidSkusSinglePageAsync(resourceGroupName, resourceName), + nextLink -> getValidSkusNextSinglePageAsync(nextLink)); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getValidSkusAsync( + String resourceGroupName, String resourceName, Context context) { + return new PagedFlux<>( + () -> getValidSkusSinglePageAsync(resourceGroupName, resourceName, context), + nextLink -> getValidSkusNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getValidSkus(String resourceGroupName, String resourceName) { + return new PagedIterable<>(getValidSkusAsync(resourceGroupName, resourceName)); + } + + /** + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getValidSkus( + String resourceGroupName, String resourceName, Context context) { + return new PagedIterable<>(getValidSkusAsync(resourceGroupName, resourceName, context)); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listEventHubConsumerGroupsSinglePageAsync( + String resourceGroupName, String resourceName, String eventHubEndpointName) { + 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 (eventHubEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listEventHubConsumerGroups( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + eventHubEndpointName, + 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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listEventHubConsumerGroupsSinglePageAsync( + String resourceGroupName, String resourceName, String eventHubEndpointName, 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 (eventHubEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listEventHubConsumerGroups( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + eventHubEndpointName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listEventHubConsumerGroupsAsync( + String resourceGroupName, String resourceName, String eventHubEndpointName) { + return new PagedFlux<>( + () -> listEventHubConsumerGroupsSinglePageAsync(resourceGroupName, resourceName, eventHubEndpointName), + nextLink -> listEventHubConsumerGroupsNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listEventHubConsumerGroupsAsync( + String resourceGroupName, String resourceName, String eventHubEndpointName, Context context) { + return new PagedFlux<>( + () -> + listEventHubConsumerGroupsSinglePageAsync( + resourceGroupName, resourceName, eventHubEndpointName, context), + nextLink -> listEventHubConsumerGroupsNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listEventHubConsumerGroups( + String resourceGroupName, String resourceName, String eventHubEndpointName) { + return new PagedIterable<>( + listEventHubConsumerGroupsAsync(resourceGroupName, resourceName, eventHubEndpointName)); + } + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listEventHubConsumerGroups( + String resourceGroupName, String resourceName, String eventHubEndpointName, Context context) { + return new PagedIterable<>( + listEventHubConsumerGroupsAsync(resourceGroupName, resourceName, eventHubEndpointName, context)); + } + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group 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 a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getEventHubConsumerGroupWithResponseAsync( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + 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 (eventHubEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getEventHubConsumerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group 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 a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getEventHubConsumerGroupWithResponseAsync( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name, 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 (eventHubEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getEventHubConsumerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + accept, + context); + } + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group 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 a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getEventHubConsumerGroupAsync( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + return getEventHubConsumerGroupWithResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group 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 a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventHubConsumerGroupInfoInner getEventHubConsumerGroup( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + return getEventHubConsumerGroupAsync(resourceGroupName, resourceName, eventHubEndpointName, name).block(); + } + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group 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 a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEventHubConsumerGroupWithResponse( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context) { + return getEventHubConsumerGroupWithResponseAsync( + resourceGroupName, resourceName, eventHubEndpointName, name, context) + .block(); + } + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. + * @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 properties of the EventHubConsumerGroupInfo object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createEventHubConsumerGroupWithResponseAsync( + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody) { + 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 (eventHubEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (consumerGroupBody == null) { + return Mono + .error(new IllegalArgumentException("Parameter consumerGroupBody is required and cannot be null.")); + } else { + consumerGroupBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createEventHubConsumerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + consumerGroupBody, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. + * @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 properties of the EventHubConsumerGroupInfo object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createEventHubConsumerGroupWithResponseAsync( + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody, + 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 (eventHubEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (consumerGroupBody == null) { + return Mono + .error(new IllegalArgumentException("Parameter consumerGroupBody is required and cannot be null.")); + } else { + consumerGroupBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createEventHubConsumerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + consumerGroupBody, + accept, + context); + } + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. + * @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 properties of the EventHubConsumerGroupInfo object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createEventHubConsumerGroupAsync( + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody) { + return createEventHubConsumerGroupWithResponseAsync( + resourceGroupName, resourceName, eventHubEndpointName, name, consumerGroupBody) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. + * @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 properties of the EventHubConsumerGroupInfo object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventHubConsumerGroupInfoInner createEventHubConsumerGroup( + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody) { + return createEventHubConsumerGroupAsync( + resourceGroupName, resourceName, eventHubEndpointName, name, consumerGroupBody) + .block(); + } + + /** + * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. + * @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 properties of the EventHubConsumerGroupInfo object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createEventHubConsumerGroupWithResponse( + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody, + Context context) { + return createEventHubConsumerGroupWithResponseAsync( + resourceGroupName, resourceName, eventHubEndpointName, name, consumerGroupBody, context) + .block(); + } + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group 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> deleteEventHubConsumerGroupWithResponseAsync( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + 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 (eventHubEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteEventHubConsumerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group 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> deleteEventHubConsumerGroupWithResponseAsync( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name, 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 (eventHubEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteEventHubConsumerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + accept, + context); + } + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group 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 deleteEventHubConsumerGroupAsync( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + return deleteEventHubConsumerGroupWithResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group 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 deleteEventHubConsumerGroup( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + deleteEventHubConsumerGroupAsync(resourceGroupName, resourceName, eventHubEndpointName, name).block(); + } + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteEventHubConsumerGroupWithResponse( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context) { + return deleteEventHubConsumerGroupWithResponseAsync( + resourceGroupName, resourceName, eventHubEndpointName, name, context) + .block(); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 the jobs in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listJobsSinglePageAsync( + 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 + .listJobs( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + 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 the jobs in an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 the jobs in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listJobsSinglePageAsync( + 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 + .listJobs( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 the jobs in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listJobsAsync(String resourceGroupName, String resourceName) { + return new PagedFlux<>( + () -> listJobsSinglePageAsync(resourceGroupName, resourceName), + nextLink -> listJobsNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 the jobs in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listJobsAsync(String resourceGroupName, String resourceName, Context context) { + return new PagedFlux<>( + () -> listJobsSinglePageAsync(resourceGroupName, resourceName, context), + nextLink -> listJobsNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 the jobs in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listJobs(String resourceGroupName, String resourceName) { + return new PagedIterable<>(listJobsAsync(resourceGroupName, resourceName)); + } + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 the jobs in an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listJobs(String resourceGroupName, String resourceName, Context context) { + return new PagedIterable<>(listJobsAsync(resourceGroupName, resourceName, context)); + } + + /** + * Get the details of a job from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job 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 the details of a job from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getJobWithResponseAsync( + String resourceGroupName, String resourceName, String jobId) { + 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 (jobId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getJob( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + jobId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the details of a job from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job 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 the details of a job from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getJobWithResponseAsync( + String resourceGroupName, String resourceName, String jobId, 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 (jobId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getJob( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + jobId, + accept, + context); + } + + /** + * Get the details of a job from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job 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 the details of a job from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getJobAsync(String resourceGroupName, String resourceName, String jobId) { + return getJobWithResponseAsync(resourceGroupName, resourceName, jobId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the details of a job from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job 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 the details of a job from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobResponseInner getJob(String resourceGroupName, String resourceName, String jobId) { + return getJobAsync(resourceGroupName, resourceName, jobId).block(); + } + + /** + * Get the details of a job from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job 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 the details of a job from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getJobWithResponse( + String resourceGroupName, String resourceName, String jobId, Context context) { + return getJobWithResponseAsync(resourceGroupName, resourceName, jobId, context).block(); + } + + /** + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 quota metrics for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getQuotaMetricsSinglePageAsync( + 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 + .getQuotaMetrics( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + 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 quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 quota metrics for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getQuotaMetricsSinglePageAsync( + 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 + .getQuotaMetrics( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 quota metrics for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getQuotaMetricsAsync(String resourceGroupName, String resourceName) { + return new PagedFlux<>( + () -> getQuotaMetricsSinglePageAsync(resourceGroupName, resourceName), + nextLink -> getQuotaMetricsNextSinglePageAsync(nextLink)); + } + + /** + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 quota metrics for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getQuotaMetricsAsync( + String resourceGroupName, String resourceName, Context context) { + return new PagedFlux<>( + () -> getQuotaMetricsSinglePageAsync(resourceGroupName, resourceName, context), + nextLink -> getQuotaMetricsNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 quota metrics for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getQuotaMetrics(String resourceGroupName, String resourceName) { + return new PagedIterable<>(getQuotaMetricsAsync(resourceGroupName, resourceName)); + } + + /** + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 quota metrics for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getQuotaMetrics( + String resourceGroupName, String resourceName, Context context) { + return new PagedIterable<>(getQuotaMetricsAsync(resourceGroupName, resourceName, context)); + } + + /** + * Get the health for routing endpoints. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param iotHubName The iotHubName 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 the health for routing endpoints. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getEndpointHealthSinglePageAsync( + String resourceGroupName, String iotHubName) { + 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 (iotHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getEndpointHealth( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + iotHubName, + 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 the health for routing endpoints. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param iotHubName The iotHubName 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 the health for routing endpoints. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getEndpointHealthSinglePageAsync( + String resourceGroupName, String iotHubName, 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 (iotHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotHubName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getEndpointHealth( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + iotHubName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the health for routing endpoints. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param iotHubName The iotHubName 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 the health for routing endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getEndpointHealthAsync(String resourceGroupName, String iotHubName) { + return new PagedFlux<>( + () -> getEndpointHealthSinglePageAsync(resourceGroupName, iotHubName), + nextLink -> getEndpointHealthNextSinglePageAsync(nextLink)); + } + + /** + * Get the health for routing endpoints. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param iotHubName The iotHubName 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 the health for routing endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getEndpointHealthAsync( + String resourceGroupName, String iotHubName, Context context) { + return new PagedFlux<>( + () -> getEndpointHealthSinglePageAsync(resourceGroupName, iotHubName, context), + nextLink -> getEndpointHealthNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the health for routing endpoints. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param iotHubName The iotHubName 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 the health for routing endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getEndpointHealth(String resourceGroupName, String iotHubName) { + return new PagedIterable<>(getEndpointHealthAsync(resourceGroupName, iotHubName)); + } + + /** + * Get the health for routing endpoints. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param iotHubName The iotHubName 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 the health for routing endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getEndpointHealth( + String resourceGroupName, String iotHubName, Context context) { + return new PagedIterable<>(getEndpointHealthAsync(resourceGroupName, iotHubName, context)); + } + + /** + * Check if an IoT hub name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT hub 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 the properties indicating whether a given IoT hub name is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + OperationInputs operationInputs) { + 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 (operationInputs == null) { + return Mono + .error(new IllegalArgumentException("Parameter operationInputs is required and cannot be null.")); + } else { + operationInputs.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + operationInputs, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Check if an IoT hub name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT hub 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 the properties indicating whether a given IoT hub name is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + OperationInputs operationInputs, 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 (operationInputs == null) { + return Mono + .error(new IllegalArgumentException("Parameter operationInputs is required and cannot be null.")); + } else { + operationInputs.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + operationInputs, + accept, + context); + } + + /** + * Check if an IoT hub name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT hub 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 the properties indicating whether a given IoT hub name is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(OperationInputs operationInputs) { + return checkNameAvailabilityWithResponseAsync(operationInputs) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check if an IoT hub name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT hub 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 the properties indicating whether a given IoT hub name is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IotHubNameAvailabilityInfoInner checkNameAvailability(OperationInputs operationInputs) { + return checkNameAvailabilityAsync(operationInputs).block(); + } + + /** + * Check if an IoT hub name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT hub 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 the properties indicating whether a given IoT hub name is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + OperationInputs operationInputs, Context context) { + return checkNameAvailabilityWithResponseAsync(operationInputs, context).block(); + } + + /** + * Test all routes configured in this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Input for testing all routes. + * @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 testing all routes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> testAllRoutesWithResponseAsync( + String iotHubName, String resourceGroupName, TestAllRoutesInput input) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (iotHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotHubName 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 (input == null) { + return Mono.error(new IllegalArgumentException("Parameter input is required and cannot be null.")); + } else { + input.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .testAllRoutes( + this.client.getEndpoint(), + iotHubName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + input, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Test all routes configured in this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Input for testing all routes. + * @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 testing all routes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> testAllRoutesWithResponseAsync( + String iotHubName, String resourceGroupName, TestAllRoutesInput input, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (iotHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotHubName 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 (input == null) { + return Mono.error(new IllegalArgumentException("Parameter input is required and cannot be null.")); + } else { + input.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .testAllRoutes( + this.client.getEndpoint(), + iotHubName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + input, + accept, + context); + } + + /** + * Test all routes configured in this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Input for testing all routes. + * @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 testing all routes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono testAllRoutesAsync( + String iotHubName, String resourceGroupName, TestAllRoutesInput input) { + return testAllRoutesWithResponseAsync(iotHubName, resourceGroupName, input) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Test all routes configured in this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Input for testing all routes. + * @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 testing all routes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestAllRoutesResultInner testAllRoutes( + String iotHubName, String resourceGroupName, TestAllRoutesInput input) { + return testAllRoutesAsync(iotHubName, resourceGroupName, input).block(); + } + + /** + * Test all routes configured in this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Input for testing all routes. + * @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 testing all routes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testAllRoutesWithResponse( + String iotHubName, String resourceGroupName, TestAllRoutesInput input, Context context) { + return testAllRoutesWithResponseAsync(iotHubName, resourceGroupName, input, context).block(); + } + + /** + * Test the new route for this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Route that needs to be tested. + * @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 testing one route. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> testRouteWithResponseAsync( + String iotHubName, String resourceGroupName, TestRouteInput input) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (iotHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotHubName 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 (input == null) { + return Mono.error(new IllegalArgumentException("Parameter input is required and cannot be null.")); + } else { + input.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .testRoute( + this.client.getEndpoint(), + iotHubName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + input, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Test the new route for this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Route that needs to be tested. + * @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 testing one route. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> testRouteWithResponseAsync( + String iotHubName, String resourceGroupName, TestRouteInput input, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (iotHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotHubName 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 (input == null) { + return Mono.error(new IllegalArgumentException("Parameter input is required and cannot be null.")); + } else { + input.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .testRoute( + this.client.getEndpoint(), + iotHubName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + input, + accept, + context); + } + + /** + * Test the new route for this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Route that needs to be tested. + * @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 testing one route. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono testRouteAsync( + String iotHubName, String resourceGroupName, TestRouteInput input) { + return testRouteWithResponseAsync(iotHubName, resourceGroupName, input) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Test the new route for this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Route that needs to be tested. + * @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 testing one route. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestRouteResultInner testRoute(String iotHubName, String resourceGroupName, TestRouteInput input) { + return testRouteAsync(iotHubName, resourceGroupName, input).block(); + } + + /** + * Test the new route for this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Route that needs to be tested. + * @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 testing one route. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testRouteWithResponse( + String iotHubName, String resourceGroupName, TestRouteInput input, Context context) { + return testRouteWithResponseAsync(iotHubName, resourceGroupName, input, context).block(); + } + + /** + * Get the security metadata for an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 security metadata for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysSinglePageAsync( + 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 + .listKeys( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + 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 security metadata for an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 security metadata for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysSinglePageAsync( + 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 + .listKeys( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the security metadata for an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 security metadata for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listKeysAsync( + String resourceGroupName, String resourceName) { + return new PagedFlux<>( + () -> listKeysSinglePageAsync(resourceGroupName, resourceName), + nextLink -> listKeysNextSinglePageAsync(nextLink)); + } + + /** + * Get the security metadata for an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 security metadata for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listKeysAsync( + String resourceGroupName, String resourceName, Context context) { + return new PagedFlux<>( + () -> listKeysSinglePageAsync(resourceGroupName, resourceName, context), + nextLink -> listKeysNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the security metadata for an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 security metadata for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listKeys( + String resourceGroupName, String resourceName) { + return new PagedIterable<>(listKeysAsync(resourceGroupName, resourceName)); + } + + /** + * Get the security metadata for an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 security metadata for an IoT hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listKeys( + String resourceGroupName, String resourceName, Context context) { + return new PagedIterable<>(listKeysAsync(resourceGroupName, resourceName, context)); + } + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @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 shared access policy by name from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getKeysForKeyNameWithResponseAsync( + String resourceGroupName, String resourceName, String keyName) { + 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 (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getKeysForKeyName( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + keyName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @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 shared access policy by name from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getKeysForKeyNameWithResponseAsync( + String resourceGroupName, String resourceName, String keyName, 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 (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getKeysForKeyName( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + keyName, + accept, + context); + } + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @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 shared access policy by name from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getKeysForKeyNameAsync( + String resourceGroupName, String resourceName, String keyName) { + return getKeysForKeyNameWithResponseAsync(resourceGroupName, resourceName, keyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @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 shared access policy by name from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedAccessSignatureAuthorizationRuleInner getKeysForKeyName( + String resourceGroupName, String resourceName, String keyName) { + return getKeysForKeyNameAsync(resourceGroupName, resourceName, keyName).block(); + } + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @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 shared access policy by name from an IoT hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getKeysForKeyNameWithResponse( + String resourceGroupName, String resourceName, String keyName, Context context) { + return getKeysForKeyNameWithResponseAsync(resourceGroupName, resourceName, keyName, context).block(); + } + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more + * information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices 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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportDevicesWithResponseAsync( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) { + 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 (exportDevicesParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter exportDevicesParameters is required and cannot be null.")); + } else { + exportDevicesParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .exportDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + exportDevicesParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more + * information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices 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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportDevicesWithResponseAsync( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters, 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 (exportDevicesParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter exportDevicesParameters is required and cannot be null.")); + } else { + exportDevicesParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .exportDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + exportDevicesParameters, + accept, + context); + } + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more + * information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices 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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportDevicesAsync( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) { + return exportDevicesWithResponseAsync(resourceGroupName, resourceName, exportDevicesParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more + * information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices 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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobResponseInner exportDevices( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) { + return exportDevicesAsync(resourceGroupName, resourceName, exportDevicesParameters).block(); + } + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more + * information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices 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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportDevicesWithResponse( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters, Context context) { + return exportDevicesWithResponseAsync(resourceGroupName, resourceName, exportDevicesParameters, context) + .block(); + } + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices 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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> importDevicesWithResponseAsync( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters) { + 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 (importDevicesParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter importDevicesParameters is required and cannot be null.")); + } else { + importDevicesParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .importDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + importDevicesParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices 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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> importDevicesWithResponseAsync( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters, 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 (importDevicesParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter importDevicesParameters is required and cannot be null.")); + } else { + importDevicesParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .importDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + importDevicesParameters, + accept, + context); + } + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices 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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importDevicesAsync( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters) { + return importDevicesWithResponseAsync(resourceGroupName, resourceName, importDevicesParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices 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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobResponseInner importDevices( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters) { + return importDevicesAsync(resourceGroupName, resourceName, importDevicesParameters).block(); + } + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices 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 properties of the Job Response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response importDevicesWithResponse( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters, Context context) { + return importDevicesWithResponseAsync(resourceGroupName, resourceName, importDevicesParameters, 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 the JSON-serialized array of IotHubDescription objects with a next link. + */ + @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 the JSON-serialized array of IotHubDescription objects with a next link. + */ + @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 the JSON-serialized array of IotHubDescription objects with a next link. + */ + @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 the JSON-serialized array of IotHubDescription objects with a next link. + */ + @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 the JSON-serialized array of IotHubSkuDescription objects with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getValidSkusNextSinglePageAsync(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.getValidSkusNext(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 the JSON-serialized array of IotHubSkuDescription objects with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getValidSkusNextSinglePageAsync( + 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 + .getValidSkusNext(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 the JSON-serialized array of Event Hub-compatible consumer group names with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listEventHubConsumerGroupsNextSinglePageAsync( + 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.listEventHubConsumerGroupsNext(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 the JSON-serialized array of Event Hub-compatible consumer group names with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listEventHubConsumerGroupsNextSinglePageAsync( + 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 + .listEventHubConsumerGroupsNext(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 the JSON-serialized array of JobResponse objects with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listJobsNextSinglePageAsync(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.listJobsNext(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 the JSON-serialized array of JobResponse objects with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listJobsNextSinglePageAsync(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 + .listJobsNext(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 the JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getQuotaMetricsNextSinglePageAsync(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.getQuotaMetricsNext(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 the JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getQuotaMetricsNextSinglePageAsync( + 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 + .getQuotaMetricsNext(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 the JSON-serialized array of EndpointHealthData objects with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getEndpointHealthNextSinglePageAsync(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.getEndpointHealthNext(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 the JSON-serialized array of EndpointHealthData objects with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getEndpointHealthNextSinglePageAsync( + 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 + .getEndpointHealthNext(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 the list of shared access policies with a next link. + */ + @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 the list of shared access policies with a next link. + */ + @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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesImpl.java new file mode 100644 index 0000000000000..b061a47ba4e23 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesImpl.java @@ -0,0 +1,686 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.IotHubResourcesClient; +import com.azure.resourcemanager.iothub.fluent.models.EndpointHealthDataInner; +import com.azure.resourcemanager.iothub.fluent.models.EventHubConsumerGroupInfoInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubNameAvailabilityInfoInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubQuotaMetricInfoInner; +import com.azure.resourcemanager.iothub.fluent.models.IotHubSkuDescriptionInner; +import com.azure.resourcemanager.iothub.fluent.models.JobResponseInner; +import com.azure.resourcemanager.iothub.fluent.models.RegistryStatisticsInner; +import com.azure.resourcemanager.iothub.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.azure.resourcemanager.iothub.fluent.models.TestAllRoutesResultInner; +import com.azure.resourcemanager.iothub.fluent.models.TestRouteResultInner; +import com.azure.resourcemanager.iothub.models.EndpointHealthData; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupInfo; +import com.azure.resourcemanager.iothub.models.ExportDevicesRequest; +import com.azure.resourcemanager.iothub.models.ImportDevicesRequest; +import com.azure.resourcemanager.iothub.models.IotHubDescription; +import com.azure.resourcemanager.iothub.models.IotHubNameAvailabilityInfo; +import com.azure.resourcemanager.iothub.models.IotHubQuotaMetricInfo; +import com.azure.resourcemanager.iothub.models.IotHubResources; +import com.azure.resourcemanager.iothub.models.IotHubSkuDescription; +import com.azure.resourcemanager.iothub.models.JobResponse; +import com.azure.resourcemanager.iothub.models.OperationInputs; +import com.azure.resourcemanager.iothub.models.RegistryStatistics; +import com.azure.resourcemanager.iothub.models.SharedAccessSignatureAuthorizationRule; +import com.azure.resourcemanager.iothub.models.TestAllRoutesInput; +import com.azure.resourcemanager.iothub.models.TestAllRoutesResult; +import com.azure.resourcemanager.iothub.models.TestRouteInput; +import com.azure.resourcemanager.iothub.models.TestRouteResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotHubResourcesImpl implements IotHubResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubResourcesImpl.class); + + private final IotHubResourcesClient innerClient; + + private final IotHubManager serviceManager; + + public IotHubResourcesImpl(IotHubResourcesClient innerClient, IotHubManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public IotHubDescription getByResourceGroup(String resourceGroupName, String resourceName) { + IotHubDescriptionInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName); + if (inner != null) { + return new IotHubDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotHubDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IotHubDescription deleteByResourceGroup(String resourceGroupName, String resourceName) { + IotHubDescriptionInner inner = this.serviceClient().delete(resourceGroupName, resourceName); + if (inner != null) { + return new IotHubDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public IotHubDescription delete(String resourceGroupName, String resourceName, Context context) { + IotHubDescriptionInner inner = this.serviceClient().delete(resourceGroupName, resourceName, context); + if (inner != null) { + return new IotHubDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new IotHubDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new IotHubDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new IotHubDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new IotHubDescriptionImpl(inner1, this.manager())); + } + + public RegistryStatistics getStats(String resourceGroupName, String resourceName) { + RegistryStatisticsInner inner = this.serviceClient().getStats(resourceGroupName, resourceName); + if (inner != null) { + return new RegistryStatisticsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getStatsWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().getStatsWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RegistryStatisticsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable getValidSkus(String resourceGroupName, String resourceName) { + PagedIterable inner = + this.serviceClient().getValidSkus(resourceGroupName, resourceName); + return inner.mapPage(inner1 -> new IotHubSkuDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable getValidSkus( + String resourceGroupName, String resourceName, Context context) { + PagedIterable inner = + this.serviceClient().getValidSkus(resourceGroupName, resourceName, context); + return inner.mapPage(inner1 -> new IotHubSkuDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listEventHubConsumerGroups( + String resourceGroupName, String resourceName, String eventHubEndpointName) { + PagedIterable inner = + this.serviceClient().listEventHubConsumerGroups(resourceGroupName, resourceName, eventHubEndpointName); + return inner.mapPage(inner1 -> new EventHubConsumerGroupInfoImpl(inner1, this.manager())); + } + + public PagedIterable listEventHubConsumerGroups( + String resourceGroupName, String resourceName, String eventHubEndpointName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listEventHubConsumerGroups(resourceGroupName, resourceName, eventHubEndpointName, context); + return inner.mapPage(inner1 -> new EventHubConsumerGroupInfoImpl(inner1, this.manager())); + } + + public EventHubConsumerGroupInfo getEventHubConsumerGroup( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + EventHubConsumerGroupInfoInner inner = + this.serviceClient().getEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name); + if (inner != null) { + return new EventHubConsumerGroupInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getEventHubConsumerGroupWithResponse( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context) { + Response inner = + this + .serviceClient() + .getEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventHubConsumerGroupInfoImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteEventHubConsumerGroup( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + this.serviceClient().deleteEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name); + } + + public Response deleteEventHubConsumerGroupWithResponse( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context) { + return this + .serviceClient() + .deleteEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, context); + } + + public PagedIterable listJobs(String resourceGroupName, String resourceName) { + PagedIterable inner = this.serviceClient().listJobs(resourceGroupName, resourceName); + return inner.mapPage(inner1 -> new JobResponseImpl(inner1, this.manager())); + } + + public PagedIterable listJobs(String resourceGroupName, String resourceName, Context context) { + PagedIterable inner = this.serviceClient().listJobs(resourceGroupName, resourceName, context); + return inner.mapPage(inner1 -> new JobResponseImpl(inner1, this.manager())); + } + + public JobResponse getJob(String resourceGroupName, String resourceName, String jobId) { + JobResponseInner inner = this.serviceClient().getJob(resourceGroupName, resourceName, jobId); + if (inner != null) { + return new JobResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getJobWithResponse( + String resourceGroupName, String resourceName, String jobId, Context context) { + Response inner = + this.serviceClient().getJobWithResponse(resourceGroupName, resourceName, jobId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable getQuotaMetrics(String resourceGroupName, String resourceName) { + PagedIterable inner = + this.serviceClient().getQuotaMetrics(resourceGroupName, resourceName); + return inner.mapPage(inner1 -> new IotHubQuotaMetricInfoImpl(inner1, this.manager())); + } + + public PagedIterable getQuotaMetrics( + String resourceGroupName, String resourceName, Context context) { + PagedIterable inner = + this.serviceClient().getQuotaMetrics(resourceGroupName, resourceName, context); + return inner.mapPage(inner1 -> new IotHubQuotaMetricInfoImpl(inner1, this.manager())); + } + + public PagedIterable getEndpointHealth(String resourceGroupName, String iotHubName) { + PagedIterable inner = + this.serviceClient().getEndpointHealth(resourceGroupName, iotHubName); + return inner.mapPage(inner1 -> new EndpointHealthDataImpl(inner1, this.manager())); + } + + public PagedIterable getEndpointHealth( + String resourceGroupName, String iotHubName, Context context) { + PagedIterable inner = + this.serviceClient().getEndpointHealth(resourceGroupName, iotHubName, context); + return inner.mapPage(inner1 -> new EndpointHealthDataImpl(inner1, this.manager())); + } + + public IotHubNameAvailabilityInfo checkNameAvailability(OperationInputs operationInputs) { + IotHubNameAvailabilityInfoInner inner = this.serviceClient().checkNameAvailability(operationInputs); + if (inner != null) { + return new IotHubNameAvailabilityInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + OperationInputs operationInputs, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(operationInputs, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IotHubNameAvailabilityInfoImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TestAllRoutesResult testAllRoutes(String iotHubName, String resourceGroupName, TestAllRoutesInput input) { + TestAllRoutesResultInner inner = this.serviceClient().testAllRoutes(iotHubName, resourceGroupName, input); + if (inner != null) { + return new TestAllRoutesResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response testAllRoutesWithResponse( + String iotHubName, String resourceGroupName, TestAllRoutesInput input, Context context) { + Response inner = + this.serviceClient().testAllRoutesWithResponse(iotHubName, resourceGroupName, input, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestAllRoutesResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TestRouteResult testRoute(String iotHubName, String resourceGroupName, TestRouteInput input) { + TestRouteResultInner inner = this.serviceClient().testRoute(iotHubName, resourceGroupName, input); + if (inner != null) { + return new TestRouteResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response testRouteWithResponse( + String iotHubName, String resourceGroupName, TestRouteInput input, Context context) { + Response inner = + this.serviceClient().testRouteWithResponse(iotHubName, resourceGroupName, input, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestRouteResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listKeys( + String resourceGroupName, String resourceName) { + PagedIterable inner = + this.serviceClient().listKeys(resourceGroupName, resourceName); + return inner.mapPage(inner1 -> new SharedAccessSignatureAuthorizationRuleImpl(inner1, this.manager())); + } + + public PagedIterable listKeys( + String resourceGroupName, String resourceName, Context context) { + PagedIterable inner = + this.serviceClient().listKeys(resourceGroupName, resourceName, context); + return inner.mapPage(inner1 -> new SharedAccessSignatureAuthorizationRuleImpl(inner1, this.manager())); + } + + public SharedAccessSignatureAuthorizationRule getKeysForKeyName( + String resourceGroupName, String resourceName, String keyName) { + SharedAccessSignatureAuthorizationRuleInner inner = + this.serviceClient().getKeysForKeyName(resourceGroupName, resourceName, keyName); + if (inner != null) { + return new SharedAccessSignatureAuthorizationRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getKeysForKeyNameWithResponse( + String resourceGroupName, String resourceName, String keyName, Context context) { + Response inner = + this.serviceClient().getKeysForKeyNameWithResponse(resourceGroupName, resourceName, keyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SharedAccessSignatureAuthorizationRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobResponse exportDevices( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) { + JobResponseInner inner = + this.serviceClient().exportDevices(resourceGroupName, resourceName, exportDevicesParameters); + if (inner != null) { + return new JobResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response exportDevicesWithResponse( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters, Context context) { + Response inner = + this + .serviceClient() + .exportDevicesWithResponse(resourceGroupName, resourceName, exportDevicesParameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobResponse importDevices( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters) { + JobResponseInner inner = + this.serviceClient().importDevices(resourceGroupName, resourceName, importDevicesParameters); + if (inner != null) { + return new JobResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response importDevicesWithResponse( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters, Context context) { + Response inner = + this + .serviceClient() + .importDevicesWithResponse(resourceGroupName, resourceName, importDevicesParameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IotHubDescription getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + } + + public EventHubConsumerGroupInfo getEventHubConsumerGroupById(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, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + String eventHubEndpointName = Utils.getValueFromIdByName(id, "eventHubEndpoints"); + if (eventHubEndpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'eventHubEndpoints'.", id))); + } + String name = Utils.getValueFromIdByName(id, "ConsumerGroups"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'ConsumerGroups'.", id))); + } + return this + .getEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, Context.NONE) + .getValue(); + } + + public Response getEventHubConsumerGroupByIdWithResponse(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, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + String eventHubEndpointName = Utils.getValueFromIdByName(id, "eventHubEndpoints"); + if (eventHubEndpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'eventHubEndpoints'.", id))); + } + String name = Utils.getValueFromIdByName(id, "ConsumerGroups"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'ConsumerGroups'.", id))); + } + return this + .getEventHubConsumerGroupWithResponse(resourceGroupName, resourceName, eventHubEndpointName, name, context); + } + + public IotHubDescription deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + return this.delete(resourceGroupName, resourceName, Context.NONE); + } + + public IotHubDescription deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + return this.delete(resourceGroupName, resourceName, context); + } + + public void deleteEventHubConsumerGroupById(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, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + String eventHubEndpointName = Utils.getValueFromIdByName(id, "eventHubEndpoints"); + if (eventHubEndpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'eventHubEndpoints'.", id))); + } + String name = Utils.getValueFromIdByName(id, "ConsumerGroups"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'ConsumerGroups'.", id))); + } + this + .deleteEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, Context.NONE) + .getValue(); + } + + public Response deleteEventHubConsumerGroupByIdWithResponse(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, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + String eventHubEndpointName = Utils.getValueFromIdByName(id, "eventHubEndpoints"); + if (eventHubEndpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'eventHubEndpoints'.", id))); + } + String name = Utils.getValueFromIdByName(id, "ConsumerGroups"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'ConsumerGroups'.", id))); + } + return this + .deleteEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, context); + } + + private IotHubResourcesClient serviceClient() { + return this.innerClient; + } + + private IotHubManager manager() { + return this.serviceManager; + } + + public IotHubDescriptionImpl define(String name) { + return new IotHubDescriptionImpl(name, this.manager()); + } + + public EventHubConsumerGroupInfoImpl defineEventHubConsumerGroup(String name) { + return new EventHubConsumerGroupInfoImpl(name, this.manager()); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubSkuDescriptionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubSkuDescriptionImpl.java new file mode 100644 index 0000000000000..25d8472772841 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubSkuDescriptionImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.IotHubSkuDescriptionInner; +import com.azure.resourcemanager.iothub.models.IotHubCapacity; +import com.azure.resourcemanager.iothub.models.IotHubSkuDescription; +import com.azure.resourcemanager.iothub.models.IotHubSkuInfo; + +public final class IotHubSkuDescriptionImpl implements IotHubSkuDescription { + private IotHubSkuDescriptionInner innerObject; + + private final IotHubManager serviceManager; + + IotHubSkuDescriptionImpl(IotHubSkuDescriptionInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public IotHubSkuInfo sku() { + return this.innerModel().sku(); + } + + public IotHubCapacity capacity() { + return this.innerModel().capacity(); + } + + public IotHubSkuDescriptionInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsClientImpl.java new file mode 100644 index 0000000000000..858554288623d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsClientImpl.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.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.iothub.fluent.IotHubsClient; +import com.azure.resourcemanager.iothub.models.ErrorDetailsException; +import com.azure.resourcemanager.iothub.models.FailoverInput; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotHubsClient. */ +public final class IotHubsClientImpl implements IotHubsClient { + private final ClientLogger logger = new ClientLogger(IotHubsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotHubsService service; + + /** The service client containing this operation class. */ + private final IotHubClientImpl client; + + /** + * Initializes an instance of IotHubsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotHubsClientImpl(IotHubClientImpl client) { + this.service = RestProxy.create(IotHubsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotHubClientIotHubs to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotHubClientIotHubs") + private interface IotHubsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs" + + "/{iotHubName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> manualFailover( + @HostParam("$host") String endpoint, + @PathParam("iotHubName") String iotHubName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FailoverInput failoverInput, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @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>> manualFailoverWithResponseAsync( + String iotHubName, String resourceGroupName, FailoverInput failoverInput) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (iotHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotHubName 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 (failoverInput == null) { + return Mono.error(new IllegalArgumentException("Parameter failoverInput is required and cannot be null.")); + } else { + failoverInput.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .manualFailover( + this.client.getEndpoint(), + iotHubName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + failoverInput, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @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>> manualFailoverWithResponseAsync( + String iotHubName, String resourceGroupName, FailoverInput failoverInput, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (iotHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter iotHubName 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 (failoverInput == null) { + return Mono.error(new IllegalArgumentException("Parameter failoverInput is required and cannot be null.")); + } else { + failoverInput.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .manualFailover( + this.client.getEndpoint(), + iotHubName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + failoverInput, + accept, + context); + } + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @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> beginManualFailoverAsync( + String iotHubName, String resourceGroupName, FailoverInput failoverInput) { + Mono>> mono = + manualFailoverWithResponseAsync(iotHubName, resourceGroupName, failoverInput); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @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> beginManualFailoverAsync( + String iotHubName, String resourceGroupName, FailoverInput failoverInput, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + manualFailoverWithResponseAsync(iotHubName, resourceGroupName, failoverInput, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @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> beginManualFailover( + String iotHubName, String resourceGroupName, FailoverInput failoverInput) { + return beginManualFailoverAsync(iotHubName, resourceGroupName, failoverInput).getSyncPoller(); + } + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @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> beginManualFailover( + String iotHubName, String resourceGroupName, FailoverInput failoverInput, Context context) { + return beginManualFailoverAsync(iotHubName, resourceGroupName, failoverInput, context).getSyncPoller(); + } + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @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 manualFailoverAsync(String iotHubName, String resourceGroupName, FailoverInput failoverInput) { + return beginManualFailoverAsync(iotHubName, resourceGroupName, failoverInput) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @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 manualFailoverAsync( + String iotHubName, String resourceGroupName, FailoverInput failoverInput, Context context) { + return beginManualFailoverAsync(iotHubName, resourceGroupName, failoverInput, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @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 manualFailover(String iotHubName, String resourceGroupName, FailoverInput failoverInput) { + manualFailoverAsync(iotHubName, resourceGroupName, failoverInput).block(); + } + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @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 manualFailover( + String iotHubName, String resourceGroupName, FailoverInput failoverInput, Context context) { + manualFailoverAsync(iotHubName, resourceGroupName, failoverInput, context).block(); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsImpl.java new file mode 100644 index 0000000000000..a4d108035a19e --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.IotHubsClient; +import com.azure.resourcemanager.iothub.models.FailoverInput; +import com.azure.resourcemanager.iothub.models.IotHubs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class IotHubsImpl implements IotHubs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubsImpl.class); + + private final IotHubsClient innerClient; + + private final IotHubManager serviceManager; + + public IotHubsImpl(IotHubsClient innerClient, IotHubManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void manualFailover(String iotHubName, String resourceGroupName, FailoverInput failoverInput) { + this.serviceClient().manualFailover(iotHubName, resourceGroupName, failoverInput); + } + + public void manualFailover( + String iotHubName, String resourceGroupName, FailoverInput failoverInput, Context context) { + this.serviceClient().manualFailover(iotHubName, resourceGroupName, failoverInput, context); + } + + private IotHubsClient serviceClient() { + return this.innerClient; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/JobResponseImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/JobResponseImpl.java new file mode 100644 index 0000000000000..4b3aa398cbc52 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/JobResponseImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.JobResponseInner; +import com.azure.resourcemanager.iothub.models.JobResponse; +import com.azure.resourcemanager.iothub.models.JobStatus; +import com.azure.resourcemanager.iothub.models.JobType; +import java.time.OffsetDateTime; + +public final class JobResponseImpl implements JobResponse { + private JobResponseInner innerObject; + + private final IotHubManager serviceManager; + + JobResponseImpl(JobResponseInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String jobId() { + return this.innerModel().jobId(); + } + + public OffsetDateTime startTimeUtc() { + return this.innerModel().startTimeUtc(); + } + + public OffsetDateTime endTimeUtc() { + return this.innerModel().endTimeUtc(); + } + + public JobType type() { + return this.innerModel().type(); + } + + public JobStatus status() { + return this.innerModel().status(); + } + + public String failureReason() { + return this.innerModel().failureReason(); + } + + public String statusMessage() { + return this.innerModel().statusMessage(); + } + + public String parentJobId() { + return this.innerModel().parentJobId(); + } + + public JobResponseInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationImpl.java new file mode 100644 index 0000000000000..7d755e0011bc0 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.OperationInner; +import com.azure.resourcemanager.iothub.models.Operation; +import com.azure.resourcemanager.iothub.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final IotHubManager serviceManager; + + OperationImpl(OperationInner innerObject, IotHubManager 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 IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..547a43f92307a --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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.iothub.fluent.OperationsClient; +import com.azure.resourcemanager.iothub.fluent.models.OperationInner; +import com.azure.resourcemanager.iothub.models.ErrorDetailsException; +import com.azure.resourcemanager.iothub.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 IotHubClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(IotHubClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotHubClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotHubClientOperatio") + 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 IoT Hub 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 IoT Hub 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 IoT Hub 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 IoT Hub 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 IoT Hub 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 IoT Hub operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available IoT Hub 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 IoT Hub operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available IoT Hub 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 IoT Hub operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available IoT Hub 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 IoT Hub 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 IoT Hub 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 IoT Hub 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..217688e6d0e9e --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.OperationsClient; +import com.azure.resourcemanager.iothub.fluent.models.OperationInner; +import com.azure.resourcemanager.iothub.models.Operation; +import com.azure.resourcemanager.iothub.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 IotHubManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, IotHubManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..90ba410f07210 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.iothub.models.PrivateEndpointConnection; +import com.azure.resourcemanager.iothub.models.PrivateEndpointConnectionProperties; + +public final class PrivateEndpointConnectionImpl implements PrivateEndpointConnection { + private PrivateEndpointConnectionInner innerObject; + + private final IotHubManager serviceManager; + + PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner innerObject, IotHubManager 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 PrivateEndpointConnectionProperties properties() { + return this.innerModel().properties(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..1835cd3339f13 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1072 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +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.iothub.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.iothub.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.iothub.models.ErrorDetailsException; +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 PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final IotHubClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(IotHubClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotHubClientPrivateEndpointConnections to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotHubClientPrivateE") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs" + + "/{resourceName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> list( + @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/iotHubs" + + "/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> get( + @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/iotHubs" + + "/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> update( + @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/iotHubs" + + "/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> delete( + @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); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + 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 + .list( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + 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 + .list( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync(String resourceGroupName, String resourceName) { + return listWithResponseAsync(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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List list(String resourceGroupName, String resourceName) { + return listAsync(resourceGroupName, resourceName).block(); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listWithResponse( + String resourceGroupName, String resourceName, Context context) { + return listWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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> getWithResponseAsync( + 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 + .get( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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> getWithResponseAsync( + 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 + .get( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 getAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return getWithResponseAsync(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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 get( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, resourceName, privateEndpointConnectionName).block(); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 getWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, resourceName, privateEndpointConnectionName, context).block(); + } + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + 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 + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + 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 + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + accept, + context); + } + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> beginUpdateAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> beginUpdateAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginUpdate( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return beginUpdateAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + .getSyncPoller(); + } + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginUpdate( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return beginUpdateAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) + .getSyncPoller(); + } + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return beginUpdateAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return beginUpdateAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner update( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return updateAsync(resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + .block(); + } + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner update( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return updateAsync( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + 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 + .delete( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + 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 + .delete( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> beginDeleteAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> beginDeleteAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginDelete( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, resourceName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginDelete( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, privateEndpointConnectionName, context) + .getSyncPoller(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return beginDeleteAsync(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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner delete( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return deleteAsync(resourceGroupName, resourceName, privateEndpointConnectionName).block(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner delete( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return deleteAsync(resourceGroupName, resourceName, privateEndpointConnectionName, context).block(); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..a5943d4f224d1 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.iothub.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.iothub.models.PrivateEndpointConnection; +import com.azure.resourcemanager.iothub.models.PrivateEndpointConnections; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final IotHubManager serviceManager; + + public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, IotHubManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public List list(String resourceGroupName, String resourceName) { + List inner = this.serviceClient().list(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> listWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response> inner = + this.serviceClient().listWithResponse(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 get( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, resourceName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(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 update( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .update(resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection update( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .update( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection delete( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().delete(resourceGroupName, resourceName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection delete( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + PrivateEndpointConnectionInner inner = + this.serviceClient().delete(resourceGroupName, resourceName, privateEndpointConnectionName, context); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..94e53c7a80992 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.iothub.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.iothub.models.GroupIdInformation; +import com.azure.resourcemanager.iothub.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 IotHubManager serviceManager; + + PrivateLinkResourcesImpl(PrivateLinkResourcesInner innerObject, IotHubManager 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 IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsClientImpl.java new file mode 100644 index 0000000000000..5a5f18c8bca70 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsClientImpl.java @@ -0,0 +1,404 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.PrivateLinkResourcesOperationsClient; +import com.azure.resourcemanager.iothub.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.iothub.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.iothub.models.ErrorDetailsException; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesOperationsClient. */ +public final class PrivateLinkResourcesOperationsClientImpl implements PrivateLinkResourcesOperationsClient { + private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateLinkResourcesOperationsService service; + + /** The service client containing this operation class. */ + private final IotHubClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesOperationsClientImpl(IotHubClientImpl client) { + this.service = + RestProxy + .create( + PrivateLinkResourcesOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotHubClientPrivateLinkResourcesOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotHubClientPrivateL") + private interface PrivateLinkResourcesOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs" + + "/{resourceName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> list( + @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/iotHubs" + + "/{resourceName}/privateLinkResources/{groupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> get( + @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); + } + + /** + * List private link resources for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + 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 + .list( + 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 IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + 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 + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * List private link resources for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String resourceName) { + return listWithResponseAsync(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 IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourcesInner list(String resourceGroupName, String resourceName) { + return listAsync(resourceGroupName, resourceName).block(); + } + + /** + * List private link resources for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 an IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String resourceName, Context context) { + return listWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Get the specified private link resource for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 + .get( + 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 IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + groupId, + accept, + context); + } + + /** + * Get the specified private link resource for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String resourceName, String groupId) { + return getWithResponseAsync(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 IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupIdInformationInner get(String resourceGroupName, String resourceName, String groupId) { + return getAsync(resourceGroupName, resourceName, groupId).block(); + } + + /** + * Get the specified private link resource for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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 IotHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context) { + return getWithResponseAsync(resourceGroupName, resourceName, groupId, context).block(); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsImpl.java new file mode 100644 index 0000000000000..2d3abdded3edd --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.PrivateLinkResourcesOperationsClient; +import com.azure.resourcemanager.iothub.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.iothub.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.iothub.models.GroupIdInformation; +import com.azure.resourcemanager.iothub.models.PrivateLinkResources; +import com.azure.resourcemanager.iothub.models.PrivateLinkResourcesOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateLinkResourcesOperationsImpl implements PrivateLinkResourcesOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesOperationsImpl.class); + + private final PrivateLinkResourcesOperationsClient innerClient; + + private final IotHubManager serviceManager; + + public PrivateLinkResourcesOperationsImpl( + PrivateLinkResourcesOperationsClient innerClient, IotHubManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PrivateLinkResources list(String resourceGroupName, String resourceName) { + PrivateLinkResourcesInner inner = this.serviceClient().list(resourceGroupName, resourceName); + if (inner != null) { + return new PrivateLinkResourcesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().listWithResponse(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 get(String resourceGroupName, String resourceName, String groupId) { + GroupIdInformationInner inner = this.serviceClient().get(resourceGroupName, resourceName, groupId); + if (inner != null) { + return new GroupIdInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context) { + Response inner = + this.serviceClient().getWithResponse(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; + } + } + + private PrivateLinkResourcesOperationsClient serviceClient() { + return this.innerClient; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/RegistryStatisticsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/RegistryStatisticsImpl.java new file mode 100644 index 0000000000000..b9a87a1539ce8 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/RegistryStatisticsImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.RegistryStatisticsInner; +import com.azure.resourcemanager.iothub.models.RegistryStatistics; + +public final class RegistryStatisticsImpl implements RegistryStatistics { + private RegistryStatisticsInner innerObject; + + private final IotHubManager serviceManager; + + RegistryStatisticsImpl(RegistryStatisticsInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Long totalDeviceCount() { + return this.innerModel().totalDeviceCount(); + } + + public Long enabledDeviceCount() { + return this.innerModel().enabledDeviceCount(); + } + + public Long disabledDeviceCount() { + return this.innerModel().disabledDeviceCount(); + } + + public RegistryStatisticsInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsClientImpl.java new file mode 100644 index 0000000000000..ed6a7ca710131 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsClientImpl.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.iothub.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.ResourceProviderCommonsClient; +import com.azure.resourcemanager.iothub.fluent.models.UserSubscriptionQuotaListResultInner; +import com.azure.resourcemanager.iothub.models.ErrorDetailsException; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProviderCommonsClient. */ +public final class ResourceProviderCommonsClientImpl implements ResourceProviderCommonsClient { + private final ClientLogger logger = new ClientLogger(ResourceProviderCommonsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProviderCommonsService service; + + /** The service client containing this operation class. */ + private final IotHubClientImpl client; + + /** + * Initializes an instance of ResourceProviderCommonsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProviderCommonsClientImpl(IotHubClientImpl client) { + this.service = + RestProxy + .create(ResourceProviderCommonsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotHubClientResourceProviderCommons to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotHubClientResource") + private interface ResourceProviderCommonsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getSubscriptionQuota( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the number of free and paid iot hubs in the subscription. + * + * @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 number of free and paid iot hubs in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionQuotaWithResponseAsync() { + 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 + .getSubscriptionQuota( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the number of free and paid iot hubs in the subscription. + * + * @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 number of free and paid iot hubs in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionQuotaWithResponseAsync( + 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 + .getSubscriptionQuota( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the number of free and paid iot hubs in the subscription. + * + * @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 number of free and paid iot hubs in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSubscriptionQuotaAsync() { + return getSubscriptionQuotaWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the number of free and paid iot hubs in the subscription. + * + * @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 number of free and paid iot hubs in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UserSubscriptionQuotaListResultInner getSubscriptionQuota() { + return getSubscriptionQuotaAsync().block(); + } + + /** + * Get the number of free and paid iot hubs in the subscription. + * + * @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 number of free and paid iot hubs in the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSubscriptionQuotaWithResponse(Context context) { + return getSubscriptionQuotaWithResponseAsync(context).block(); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsImpl.java new file mode 100644 index 0000000000000..e6cb3786eee5e --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsImpl.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.iothub.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.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.ResourceProviderCommonsClient; +import com.azure.resourcemanager.iothub.fluent.models.UserSubscriptionQuotaListResultInner; +import com.azure.resourcemanager.iothub.models.ResourceProviderCommons; +import com.azure.resourcemanager.iothub.models.UserSubscriptionQuotaListResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProviderCommonsImpl implements ResourceProviderCommons { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderCommonsImpl.class); + + private final ResourceProviderCommonsClient innerClient; + + private final IotHubManager serviceManager; + + public ResourceProviderCommonsImpl(ResourceProviderCommonsClient innerClient, IotHubManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public UserSubscriptionQuotaListResult getSubscriptionQuota() { + UserSubscriptionQuotaListResultInner inner = this.serviceClient().getSubscriptionQuota(); + if (inner != null) { + return new UserSubscriptionQuotaListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSubscriptionQuotaWithResponse(Context context) { + Response inner = + this.serviceClient().getSubscriptionQuotaWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new UserSubscriptionQuotaListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ResourceProviderCommonsClient serviceClient() { + return this.innerClient; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/SharedAccessSignatureAuthorizationRuleImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/SharedAccessSignatureAuthorizationRuleImpl.java new file mode 100644 index 0000000000000..150d9d3570da7 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/SharedAccessSignatureAuthorizationRuleImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.azure.resourcemanager.iothub.models.AccessRights; +import com.azure.resourcemanager.iothub.models.SharedAccessSignatureAuthorizationRule; + +public final class SharedAccessSignatureAuthorizationRuleImpl implements SharedAccessSignatureAuthorizationRule { + private SharedAccessSignatureAuthorizationRuleInner innerObject; + + private final IotHubManager serviceManager; + + SharedAccessSignatureAuthorizationRuleImpl( + SharedAccessSignatureAuthorizationRuleInner innerObject, IotHubManager 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 AccessRights rights() { + return this.innerModel().rights(); + } + + public SharedAccessSignatureAuthorizationRuleInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestAllRoutesResultImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestAllRoutesResultImpl.java new file mode 100644 index 0000000000000..4af9568b52ede --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestAllRoutesResultImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.TestAllRoutesResultInner; +import com.azure.resourcemanager.iothub.models.MatchedRoute; +import com.azure.resourcemanager.iothub.models.TestAllRoutesResult; +import java.util.Collections; +import java.util.List; + +public final class TestAllRoutesResultImpl implements TestAllRoutesResult { + private TestAllRoutesResultInner innerObject; + + private final IotHubManager serviceManager; + + TestAllRoutesResultImpl(TestAllRoutesResultInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List routes() { + List inner = this.innerModel().routes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public TestAllRoutesResultInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestRouteResultImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestRouteResultImpl.java new file mode 100644 index 0000000000000..1c2440653f39b --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestRouteResultImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.TestRouteResultInner; +import com.azure.resourcemanager.iothub.models.TestResultStatus; +import com.azure.resourcemanager.iothub.models.TestRouteResult; +import com.azure.resourcemanager.iothub.models.TestRouteResultDetails; + +public final class TestRouteResultImpl implements TestRouteResult { + private TestRouteResultInner innerObject; + + private final IotHubManager serviceManager; + + TestRouteResultImpl(TestRouteResultInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public TestResultStatus result() { + return this.innerModel().result(); + } + + public TestRouteResultDetails details() { + return this.innerModel().details(); + } + + public TestRouteResultInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/UserSubscriptionQuotaListResultImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/UserSubscriptionQuotaListResultImpl.java new file mode 100644 index 0000000000000..2d567ed3f87e8 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/UserSubscriptionQuotaListResultImpl.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.iothub.implementation; + +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.UserSubscriptionQuotaListResultInner; +import com.azure.resourcemanager.iothub.models.UserSubscriptionQuota; +import com.azure.resourcemanager.iothub.models.UserSubscriptionQuotaListResult; +import java.util.Collections; +import java.util.List; + +public final class UserSubscriptionQuotaListResultImpl implements UserSubscriptionQuotaListResult { + private UserSubscriptionQuotaListResultInner innerObject; + + private final IotHubManager serviceManager; + + UserSubscriptionQuotaListResultImpl( + UserSubscriptionQuotaListResultInner innerObject, IotHubManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public UserSubscriptionQuotaListResultInner innerModel() { + return this.innerObject; + } + + private IotHubManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/Utils.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/Utils.java new file mode 100644 index 0000000000000..468a7c42b33c8 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/Utils.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.iothub.implementation; + +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; + +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; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/package-info.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/package-info.java new file mode 100644 index 0000000000000..1474875a8c357 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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 IotHubClient. Use this API to manage the IoT hubs in your Azure + * subscription. + */ +package com.azure.resourcemanager.iothub.implementation; diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/AccessRights.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/AccessRights.java new file mode 100644 index 0000000000000..d738504023750 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/AccessRights.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AccessRights. */ +public enum AccessRights { + /** Enum value RegistryRead. */ + REGISTRY_READ("RegistryRead"), + + /** Enum value RegistryWrite. */ + REGISTRY_WRITE("RegistryWrite"), + + /** Enum value ServiceConnect. */ + SERVICE_CONNECT("ServiceConnect"), + + /** Enum value DeviceConnect. */ + DEVICE_CONNECT("DeviceConnect"), + + /** Enum value RegistryRead, RegistryWrite. */ + REGISTRY_READ_REGISTRY_WRITE("RegistryRead, RegistryWrite"), + + /** Enum value RegistryRead, ServiceConnect. */ + REGISTRY_READ_SERVICE_CONNECT("RegistryRead, ServiceConnect"), + + /** Enum value RegistryRead, DeviceConnect. */ + REGISTRY_READ_DEVICE_CONNECT("RegistryRead, DeviceConnect"), + + /** Enum value RegistryWrite, ServiceConnect. */ + REGISTRY_WRITE_SERVICE_CONNECT("RegistryWrite, ServiceConnect"), + + /** Enum value RegistryWrite, DeviceConnect. */ + REGISTRY_WRITE_DEVICE_CONNECT("RegistryWrite, DeviceConnect"), + + /** Enum value ServiceConnect, DeviceConnect. */ + SERVICE_CONNECT_DEVICE_CONNECT("ServiceConnect, DeviceConnect"), + + /** Enum value RegistryRead, RegistryWrite, ServiceConnect. */ + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT("RegistryRead, RegistryWrite, ServiceConnect"), + + /** Enum value RegistryRead, RegistryWrite, DeviceConnect. */ + REGISTRY_READ_REGISTRY_WRITE_DEVICE_CONNECT("RegistryRead, RegistryWrite, DeviceConnect"), + + /** Enum value RegistryRead, ServiceConnect, DeviceConnect. */ + REGISTRY_READ_SERVICE_CONNECT_DEVICE_CONNECT("RegistryRead, ServiceConnect, DeviceConnect"), + + /** Enum value RegistryWrite, ServiceConnect, DeviceConnect. */ + REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT("RegistryWrite, ServiceConnect, DeviceConnect"), + + /** Enum value RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect. */ + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT( + "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect"); + + /** The actual serialized value for a AccessRights instance. */ + private final String value; + + AccessRights(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccessRights instance. + * + * @param value the serialized value to parse. + * @return the parsed AccessRights object, or null if unable to parse. + */ + @JsonCreator + public static AccessRights fromString(String value) { + AccessRights[] items = AccessRights.values(); + for (AccessRights item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/AuthenticationType.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/AuthenticationType.java new file mode 100644 index 0000000000000..0e2183e55c395 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/AuthenticationType.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.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AuthenticationType. */ +public final class AuthenticationType extends ExpandableStringEnum { + /** Static value keyBased for AuthenticationType. */ + public static final AuthenticationType KEY_BASED = fromString("keyBased"); + + /** Static value identityBased for AuthenticationType. */ + public static final AuthenticationType IDENTITY_BASED = fromString("identityBased"); + + /** + * Creates or finds a AuthenticationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationType. + */ + @JsonCreator + public static AuthenticationType fromString(String name) { + return fromString(name, AuthenticationType.class); + } + + /** @return known AuthenticationType values. */ + public static Collection values() { + return values(AuthenticationType.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Capabilities.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Capabilities.java new file mode 100644 index 0000000000000..747e48444bd3e --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Capabilities.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.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Capabilities. */ +public final class Capabilities extends ExpandableStringEnum { + /** Static value None for Capabilities. */ + public static final Capabilities NONE = fromString("None"); + + /** Static value DeviceManagement for Capabilities. */ + public static final Capabilities DEVICE_MANAGEMENT = fromString("DeviceManagement"); + + /** + * Creates or finds a Capabilities from its string representation. + * + * @param name a name to look for. + * @return the corresponding Capabilities. + */ + @JsonCreator + public static Capabilities fromString(String name) { + return fromString(name, Capabilities.class); + } + + /** @return known Capabilities values. */ + public static Collection values() { + return values(Capabilities.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java new file mode 100644 index 0000000000000..71f56c61ddd8b --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner; + +/** An immutable client-side representation of CertificateDescription. */ +public interface CertificateDescription { + /** + * 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 description of an X509 CA 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.iothub.fluent.models.CertificateDescriptionInner object. + * + * @return the inner object. + */ + CertificateDescriptionInner innerModel(); + + /** The entirety of the CertificateDescription definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The CertificateDescription definition stages. */ + interface DefinitionStages { + /** The first stage of the CertificateDescription definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the CertificateDescription definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, resourceName. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @return the next definition stage. + */ + WithCreate withExistingIotHub(String resourceGroupName, String resourceName); + } + /** + * The stage of the CertificateDescription 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.WithProperties, DefinitionStages.WithIfMatch { + /** + * Executes the create request. + * + * @return the created resource. + */ + CertificateDescription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CertificateDescription create(Context context); + } + /** The stage of the CertificateDescription definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The description of an X509 CA Certificate.. + * + * @param properties The description of an X509 CA Certificate. + * @return the next definition stage. + */ + WithCreate withProperties(CertificateProperties properties); + } + /** The stage of the CertificateDescription definition allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: ETag of the Certificate. Do not specify for creating a brand new + * certificate. Required to update an existing certificate.. + * + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to + * update an existing certificate. + * @return the next definition stage. + */ + WithCreate withIfMatch(String ifMatch); + } + } + /** + * Begins update for the CertificateDescription resource. + * + * @return the stage of resource update. + */ + CertificateDescription.Update update(); + + /** The template for CertificateDescription update. */ + interface Update extends UpdateStages.WithProperties, UpdateStages.WithIfMatch { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CertificateDescription apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CertificateDescription apply(Context context); + } + /** The CertificateDescription update stages. */ + interface UpdateStages { + /** The stage of the CertificateDescription update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The description of an X509 CA Certificate.. + * + * @param properties The description of an X509 CA Certificate. + * @return the next definition stage. + */ + Update withProperties(CertificateProperties properties); + } + /** The stage of the CertificateDescription update allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: ETag of the Certificate. Do not specify for creating a brand new + * certificate. Required to update an existing certificate.. + * + * @param ifMatch ETag of the Certificate. Do not specify for creating a brand new certificate. Required to + * update an existing certificate. + * @return the next definition stage. + */ + Update withIfMatch(String ifMatch); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CertificateDescription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CertificateDescription refresh(Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateListDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateListDescription.java new file mode 100644 index 0000000000000..5d64676d52f1a --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateListDescription.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.iothub.models; + +import com.azure.resourcemanager.iothub.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.iothub.fluent.models.CertificateListDescriptionInner object. + * + * @return the inner object. + */ + CertificateListDescriptionInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateProperties.java new file mode 100644 index 0000000000000..9ccae5fc4b0a2 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateProperties.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.annotation.Fluent; +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. */ +@Fluent +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 create 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; + + /* + * The certificate content + */ + @JsonProperty(value = "certificate") + private String certificate; + + /** + * 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 create 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(); + } + + /** + * Get the certificate property: The certificate content. + * + * @return the certificate value. + */ + public String certificate() { + return this.certificate; + } + + /** + * Set the certificate property: The certificate content. + * + * @param certificate the certificate value to set. + * @return the CertificateProperties object itself. + */ + public CertificateProperties 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificatePropertiesWithNonce.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificatePropertiesWithNonce.java new file mode 100644 index 0000000000000..d806712d99969 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificatePropertiesWithNonce.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 including the challenge nonce issued for the Proof-Of-Possession flow. */ +@Immutable +public final class CertificatePropertiesWithNonce { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificatePropertiesWithNonce.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 create 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; + + /* + * The certificate's verification code that will be used for proof of + * possession. + */ + @JsonProperty(value = "verificationCode", access = JsonProperty.Access.WRITE_ONLY) + private String verificationCode; + + /* + * The certificate content + */ + @JsonProperty(value = "certificate", access = JsonProperty.Access.WRITE_ONLY) + private String certificate; + + /** + * 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 create 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(); + } + + /** + * Get the verificationCode property: The certificate's verification code that will be used for proof of possession. + * + * @return the verificationCode value. + */ + public String verificationCode() { + return this.verificationCode; + } + + /** + * Get the certificate property: The certificate content. + * + * @return the certificate value. + */ + public String certificate() { + return this.certificate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateVerificationDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateVerificationDescription.java new file mode 100644 index 0000000000000..22f1975e95ed0 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateVerificationDescription.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.iothub.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 CertificateVerificationDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateVerificationDescription.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 CertificateVerificationDescription object itself. + */ + public CertificateVerificationDescription 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateWithNonceDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateWithNonceDescription.java new file mode 100644 index 0000000000000..a96afa5f98fce --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateWithNonceDescription.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.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.CertificateWithNonceDescriptionInner; + +/** An immutable client-side representation of CertificateWithNonceDescription. */ +public interface CertificateWithNonceDescription { + /** + * 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 description of an X509 CA Certificate including the challenge nonce issued for + * the Proof-Of-Possession flow. + * + * @return the properties value. + */ + CertificatePropertiesWithNonce properties(); + + /** + * Gets the etag property: The entity tag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.CertificateWithNonceDescriptionInner object. + * + * @return the inner object. + */ + CertificateWithNonceDescriptionInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Certificates.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Certificates.java new file mode 100644 index 0000000000000..e0d0c7c3c1525 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Certificates.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Certificates. */ +public interface Certificates { + /** + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 JSON-serialized array of Certificate objects. + */ + CertificateListDescription listByIotHub(String resourceGroupName, String resourceName); + + /** + * Returns the list of certificates. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 JSON-serialized array of Certificate objects. + */ + Response listByIotHubWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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. + */ + CertificateDescription get(String resourceGroupName, String resourceName, String certificateName); + + /** + * Returns the certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 getWithResponse( + String resourceGroupName, String resourceName, String certificateName, Context context); + + /** + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 resourceName, String certificateName, String ifMatch); + + /** + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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.iothub.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 resourceName, String certificateName, String ifMatch, Context context); + + /** + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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. + */ + CertificateWithNonceDescription generateVerificationCode( + String resourceGroupName, String resourceName, String certificateName, String ifMatch); + + /** + * Generates verification code for proof of possession flow. The verification code will be used to generate a leaf + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @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.iothub.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 generateVerificationCodeWithResponse( + String resourceGroupName, String resourceName, String certificateName, String ifMatch, Context context); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @param certificateVerificationBody The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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. + */ + CertificateDescription verify( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param certificateName The name of the certificate. + * @param ifMatch ETag of the Certificate. + * @param certificateVerificationBody The name of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 verifyWithResponse( + String resourceGroupName, + String resourceName, + String certificateName, + String ifMatch, + CertificateVerificationDescription certificateVerificationBody, + Context context); + + /** + * Returns the certificate. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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. + */ + CertificateDescription getById(String id); + + /** + * Returns the certificate. + * + * @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.iothub.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 getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing X509 certificate or does nothing if it does not exist. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an existing X509 certificate or does nothing if it does not exist. + * + * @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.iothub.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, Context context); + + /** + * Begins definition for a new CertificateDescription resource. + * + * @param name resource name. + * @return the first stage of the new CertificateDescription definition. + */ + CertificateDescription.DefinitionStages.Blank define(String name); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CloudToDeviceProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CloudToDeviceProperties.java new file mode 100644 index 0000000000000..06b3dafbf2db3 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CloudToDeviceProperties.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.iothub.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.time.Duration; + +/** The IoT hub cloud-to-device messaging properties. */ +@Fluent +public final class CloudToDeviceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudToDeviceProperties.class); + + /* + * The max delivery count for cloud-to-device messages in the device queue. + * See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + */ + @JsonProperty(value = "maxDeliveryCount") + private Integer maxDeliveryCount; + + /* + * The default time to live for cloud-to-device messages in the device + * queue. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + */ + @JsonProperty(value = "defaultTtlAsIso8601") + private Duration defaultTtlAsIso8601; + + /* + * The properties of the feedback queue for cloud-to-device messages. + */ + @JsonProperty(value = "feedback") + private FeedbackProperties feedback; + + /** + * Get the maxDeliveryCount property: The max delivery count for cloud-to-device messages in the device queue. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + * + * @return the maxDeliveryCount value. + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set the maxDeliveryCount property: The max delivery count for cloud-to-device messages in the device queue. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + * + * @param maxDeliveryCount the maxDeliveryCount value to set. + * @return the CloudToDeviceProperties object itself. + */ + public CloudToDeviceProperties withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + + /** + * Get the defaultTtlAsIso8601 property: The default time to live for cloud-to-device messages in the device queue. + * See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + * + * @return the defaultTtlAsIso8601 value. + */ + public Duration defaultTtlAsIso8601() { + return this.defaultTtlAsIso8601; + } + + /** + * Set the defaultTtlAsIso8601 property: The default time to live for cloud-to-device messages in the device queue. + * See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + * + * @param defaultTtlAsIso8601 the defaultTtlAsIso8601 value to set. + * @return the CloudToDeviceProperties object itself. + */ + public CloudToDeviceProperties withDefaultTtlAsIso8601(Duration defaultTtlAsIso8601) { + this.defaultTtlAsIso8601 = defaultTtlAsIso8601; + return this; + } + + /** + * Get the feedback property: The properties of the feedback queue for cloud-to-device messages. + * + * @return the feedback value. + */ + public FeedbackProperties feedback() { + return this.feedback; + } + + /** + * Set the feedback property: The properties of the feedback queue for cloud-to-device messages. + * + * @param feedback the feedback value to set. + * @return the CloudToDeviceProperties object itself. + */ + public CloudToDeviceProperties withFeedback(FeedbackProperties feedback) { + this.feedback = feedback; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (feedback() != null) { + feedback().validate(); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/DefaultAction.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/DefaultAction.java new file mode 100644 index 0000000000000..4731ff0dc046a --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/DefaultAction.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.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DefaultAction. */ +public final class DefaultAction extends ExpandableStringEnum { + /** Static value Deny for DefaultAction. */ + public static final DefaultAction DENY = fromString("Deny"); + + /** Static value Allow for DefaultAction. */ + public static final DefaultAction ALLOW = fromString("Allow"); + + /** + * Creates or finds a DefaultAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding DefaultAction. + */ + @JsonCreator + public static DefaultAction fromString(String name) { + return fromString(name, DefaultAction.class); + } + + /** @return known DefaultAction values. */ + public static Collection values() { + return values(DefaultAction.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthData.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthData.java new file mode 100644 index 0000000000000..3ab6be25f96a6 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthData.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.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.EndpointHealthDataInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of EndpointHealthData. */ +public interface EndpointHealthData { + /** + * Gets the endpointId property: Id of the endpoint. + * + * @return the endpointId value. + */ + String endpointId(); + + /** + * Gets the healthStatus property: Health statuses have following meanings. The 'healthy' status shows that the + * endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint is not accepting + * messages as expected and IoT Hub is retrying to send data to this endpoint. The status of an unhealthy endpoint + * will be updated to healthy when IoT Hub has established an eventually consistent state of health. The 'dead' + * status shows that the endpoint is not accepting messages, after IoT Hub retried sending messages for the retrial + * period. See IoT Hub metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + * the IoT Hub has not established a connection with the endpoint. No messages have been delivered to or rejected + * from this endpoint. + * + * @return the healthStatus value. + */ + EndpointHealthStatus healthStatus(); + + /** + * Gets the lastKnownError property: Last error obtained when a message failed to be delivered to iot hub. + * + * @return the lastKnownError value. + */ + String lastKnownError(); + + /** + * Gets the lastKnownErrorTime property: Time at which the last known error occurred. + * + * @return the lastKnownErrorTime value. + */ + OffsetDateTime lastKnownErrorTime(); + + /** + * Gets the lastSuccessfulSendAttemptTime property: Last time iot hub successfully sent a message to the endpoint. + * + * @return the lastSuccessfulSendAttemptTime value. + */ + OffsetDateTime lastSuccessfulSendAttemptTime(); + + /** + * Gets the lastSendAttemptTime property: Last time iot hub tried to send a message to the endpoint. + * + * @return the lastSendAttemptTime value. + */ + OffsetDateTime lastSendAttemptTime(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.EndpointHealthDataInner object. + * + * @return the inner object. + */ + EndpointHealthDataInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthDataListResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthDataListResult.java new file mode 100644 index 0000000000000..5bf5ac5620277 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthDataListResult.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.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.models.EndpointHealthDataInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JSON-serialized array of EndpointHealthData objects with a next link. */ +@Fluent +public final class EndpointHealthDataListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EndpointHealthDataListResult.class); + + /* + * JSON-serialized array of Endpoint health data + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to more results + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: JSON-serialized array of Endpoint health data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: JSON-serialized array of Endpoint health data. + * + * @param value the value value to set. + * @return the EndpointHealthDataListResult object itself. + */ + public EndpointHealthDataListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to more results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthStatus.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthStatus.java new file mode 100644 index 0000000000000..29f6463f85ddc --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthStatus.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EndpointHealthStatus. */ +public final class EndpointHealthStatus extends ExpandableStringEnum { + /** Static value unknown for EndpointHealthStatus. */ + public static final EndpointHealthStatus UNKNOWN = fromString("unknown"); + + /** Static value healthy for EndpointHealthStatus. */ + public static final EndpointHealthStatus HEALTHY = fromString("healthy"); + + /** Static value degraded for EndpointHealthStatus. */ + public static final EndpointHealthStatus DEGRADED = fromString("degraded"); + + /** Static value unhealthy for EndpointHealthStatus. */ + public static final EndpointHealthStatus UNHEALTHY = fromString("unhealthy"); + + /** Static value dead for EndpointHealthStatus. */ + public static final EndpointHealthStatus DEAD = fromString("dead"); + + /** + * Creates or finds a EndpointHealthStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding EndpointHealthStatus. + */ + @JsonCreator + public static EndpointHealthStatus fromString(String name) { + return fromString(name, EndpointHealthStatus.class); + } + + /** @return known EndpointHealthStatus values. */ + public static Collection values() { + return values(EndpointHealthStatus.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EnrichmentProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EnrichmentProperties.java new file mode 100644 index 0000000000000..7e4ddafb1ab8d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EnrichmentProperties.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.iothub.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 of an enrichment that your IoT hub applies to messages delivered to endpoints. */ +@Fluent +public final class EnrichmentProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnrichmentProperties.class); + + /* + * The key or name for the enrichment property. + */ + @JsonProperty(value = "key", required = true) + private String key; + + /* + * The value for the enrichment property. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /* + * The list of endpoints for which the enrichment is applied to the + * message. + */ + @JsonProperty(value = "endpointNames", required = true) + private List endpointNames; + + /** + * Get the key property: The key or name for the enrichment property. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: The key or name for the enrichment property. + * + * @param key the key value to set. + * @return the EnrichmentProperties object itself. + */ + public EnrichmentProperties withKey(String key) { + this.key = key; + return this; + } + + /** + * Get the value property: The value for the enrichment property. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value for the enrichment property. + * + * @param value the value value to set. + * @return the EnrichmentProperties object itself. + */ + public EnrichmentProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the endpointNames property: The list of endpoints for which the enrichment is applied to the message. + * + * @return the endpointNames value. + */ + public List endpointNames() { + return this.endpointNames; + } + + /** + * Set the endpointNames property: The list of endpoints for which the enrichment is applied to the message. + * + * @param endpointNames the endpointNames value to set. + * @return the EnrichmentProperties object itself. + */ + public EnrichmentProperties withEndpointNames(List endpointNames) { + this.endpointNames = endpointNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (key() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property key in model EnrichmentProperties")); + } + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model EnrichmentProperties")); + } + if (endpointNames() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property endpointNames in model EnrichmentProperties")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ErrorDetails.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ErrorDetails.java new file mode 100644 index 0000000000000..32cb77dcce3cf --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ErrorDetailsException.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ErrorDetailsException.java new file mode 100644 index 0000000000000..0ac444647385d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupBodyDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupBodyDescription.java new file mode 100644 index 0000000000000..61ef014f5a70d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupBodyDescription.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.iothub.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 EventHub consumer group. */ +@Fluent +public final class EventHubConsumerGroupBodyDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EventHubConsumerGroupBodyDescription.class); + + /* + * The EventHub consumer group name. + */ + @JsonProperty(value = "properties") + private EventHubConsumerGroupName properties; + + /** + * Get the properties property: The EventHub consumer group name. + * + * @return the properties value. + */ + public EventHubConsumerGroupName properties() { + return this.properties; + } + + /** + * Set the properties property: The EventHub consumer group name. + * + * @param properties the properties value to set. + * @return the EventHubConsumerGroupBodyDescription object itself. + */ + public EventHubConsumerGroupBodyDescription withProperties(EventHubConsumerGroupName 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupInfo.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupInfo.java new file mode 100644 index 0000000000000..0665c2427493e --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupInfo.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.iothub.fluent.models.EventHubConsumerGroupInfoInner; +import java.util.Map; + +/** An immutable client-side representation of EventHubConsumerGroupInfo. */ +public interface EventHubConsumerGroupInfo { + /** + * 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 tags. + * + * @return the properties value. + */ + Map properties(); + + /** + * Gets the etag property: The etag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.EventHubConsumerGroupInfoInner object. + * + * @return the inner object. + */ + EventHubConsumerGroupInfoInner innerModel(); + + /** The entirety of the EventHubConsumerGroupInfo definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The EventHubConsumerGroupInfo definition stages. */ + interface DefinitionStages { + /** The first stage of the EventHubConsumerGroupInfo definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the EventHubConsumerGroupInfo definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, resourceName, eventHubEndpointName. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @return the next definition stage. + */ + WithCreate withExistingEventHubEndpoint( + String resourceGroupName, String resourceName, String eventHubEndpointName); + } + /** + * The stage of the EventHubConsumerGroupInfo 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.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + EventHubConsumerGroupInfo create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EventHubConsumerGroupInfo create(Context context); + } + /** The stage of the EventHubConsumerGroupInfo definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The EventHub consumer group name.. + * + * @param properties The EventHub consumer group name. + * @return the next definition stage. + */ + WithCreate withProperties(EventHubConsumerGroupName properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EventHubConsumerGroupInfo refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EventHubConsumerGroupInfo refresh(Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupName.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupName.java new file mode 100644 index 0000000000000..e2da540e421ed --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupName.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.iothub.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 EventHub consumer group name. */ +@Fluent +public final class EventHubConsumerGroupName { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EventHubConsumerGroupName.class); + + /* + * EventHub consumer group name + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: EventHub consumer group name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: EventHub consumer group name. + * + * @param name the name value to set. + * @return the EventHubConsumerGroupName object itself. + */ + public EventHubConsumerGroupName withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupsListResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupsListResult.java new file mode 100644 index 0000000000000..5b3e83021bc75 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupsListResult.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.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.models.EventHubConsumerGroupInfoInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JSON-serialized array of Event Hub-compatible consumer group names with a next link. */ +@Fluent +public final class EventHubConsumerGroupsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EventHubConsumerGroupsListResult.class); + + /* + * List of consumer groups objects + */ + @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 consumer groups objects. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of consumer groups objects. + * + * @param value the value value to set. + * @return the EventHubConsumerGroupsListResult object itself. + */ + public EventHubConsumerGroupsListResult 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubProperties.java new file mode 100644 index 0000000000000..d1d786e80b1ed --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubProperties.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 of the provisioned Event Hub-compatible endpoint used by the IoT hub. */ +@Fluent +public final class EventHubProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EventHubProperties.class); + + /* + * The retention time for device-to-cloud messages in days. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages + */ + @JsonProperty(value = "retentionTimeInDays") + private Long retentionTimeInDays; + + /* + * The number of partitions for receiving device-to-cloud messages in the + * Event Hub-compatible endpoint. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + */ + @JsonProperty(value = "partitionCount") + private Integer partitionCount; + + /* + * The partition ids in the Event Hub-compatible endpoint. + */ + @JsonProperty(value = "partitionIds", access = JsonProperty.Access.WRITE_ONLY) + private List partitionIds; + + /* + * The Event Hub-compatible name. + */ + @JsonProperty(value = "path", access = JsonProperty.Access.WRITE_ONLY) + private String path; + + /* + * The Event Hub-compatible endpoint. + */ + @JsonProperty(value = "endpoint", access = JsonProperty.Access.WRITE_ONLY) + private String endpoint; + + /** + * Get the retentionTimeInDays property: The retention time for device-to-cloud messages in days. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + * + * @return the retentionTimeInDays value. + */ + public Long retentionTimeInDays() { + return this.retentionTimeInDays; + } + + /** + * Set the retentionTimeInDays property: The retention time for device-to-cloud messages in days. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + * + * @param retentionTimeInDays the retentionTimeInDays value to set. + * @return the EventHubProperties object itself. + */ + public EventHubProperties withRetentionTimeInDays(Long retentionTimeInDays) { + this.retentionTimeInDays = retentionTimeInDays; + return this; + } + + /** + * Get the partitionCount property: The number of partitions for receiving device-to-cloud messages in the Event + * Hub-compatible endpoint. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + * + * @return the partitionCount value. + */ + public Integer partitionCount() { + return this.partitionCount; + } + + /** + * Set the partitionCount property: The number of partitions for receiving device-to-cloud messages in the Event + * Hub-compatible endpoint. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + * + * @param partitionCount the partitionCount value to set. + * @return the EventHubProperties object itself. + */ + public EventHubProperties withPartitionCount(Integer partitionCount) { + this.partitionCount = partitionCount; + return this; + } + + /** + * Get the partitionIds property: The partition ids in the Event Hub-compatible endpoint. + * + * @return the partitionIds value. + */ + public List partitionIds() { + return this.partitionIds; + } + + /** + * Get the path property: The Event Hub-compatible name. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Get the endpoint property: The Event Hub-compatible endpoint. + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ExportDevicesRequest.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ExportDevicesRequest.java new file mode 100644 index 0000000000000..620d3cb9a3a81 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ExportDevicesRequest.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** Use to provide parameters when requesting an export of all devices in the IoT hub. */ +@Fluent +public final class ExportDevicesRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExportDevicesRequest.class); + + /* + * The export blob container URI. + */ + @JsonProperty(value = "exportBlobContainerUri", required = true) + private String exportBlobContainerUri; + + /* + * The value indicating whether keys should be excluded during export. + */ + @JsonProperty(value = "excludeKeys", required = true) + private boolean excludeKeys; + + /* + * The name of the blob that will be created in the provided output blob + * container. This blob will contain the exported device registry + * information for the IoT Hub. + */ + @JsonProperty(value = "exportBlobName") + private String exportBlobName; + + /* + * Specifies authentication type being used for connecting to the storage + * account. + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /* + * The value indicating whether configurations should be exported. + */ + @JsonProperty(value = "includeConfigurations") + private Boolean includeConfigurations; + + /* + * The name of the blob that will be created in the provided output blob + * container. This blob will contain the exported configurations for the + * Iot Hub. + */ + @JsonProperty(value = "configurationsBlobName") + private String configurationsBlobName; + + /** + * Get the exportBlobContainerUri property: The export blob container URI. + * + * @return the exportBlobContainerUri value. + */ + public String exportBlobContainerUri() { + return this.exportBlobContainerUri; + } + + /** + * Set the exportBlobContainerUri property: The export blob container URI. + * + * @param exportBlobContainerUri the exportBlobContainerUri value to set. + * @return the ExportDevicesRequest object itself. + */ + public ExportDevicesRequest withExportBlobContainerUri(String exportBlobContainerUri) { + this.exportBlobContainerUri = exportBlobContainerUri; + return this; + } + + /** + * Get the excludeKeys property: The value indicating whether keys should be excluded during export. + * + * @return the excludeKeys value. + */ + public boolean excludeKeys() { + return this.excludeKeys; + } + + /** + * Set the excludeKeys property: The value indicating whether keys should be excluded during export. + * + * @param excludeKeys the excludeKeys value to set. + * @return the ExportDevicesRequest object itself. + */ + public ExportDevicesRequest withExcludeKeys(boolean excludeKeys) { + this.excludeKeys = excludeKeys; + return this; + } + + /** + * Get the exportBlobName property: The name of the blob that will be created in the provided output blob container. + * This blob will contain the exported device registry information for the IoT Hub. + * + * @return the exportBlobName value. + */ + public String exportBlobName() { + return this.exportBlobName; + } + + /** + * Set the exportBlobName property: The name of the blob that will be created in the provided output blob container. + * This blob will contain the exported device registry information for the IoT Hub. + * + * @param exportBlobName the exportBlobName value to set. + * @return the ExportDevicesRequest object itself. + */ + public ExportDevicesRequest withExportBlobName(String exportBlobName) { + this.exportBlobName = exportBlobName; + return this; + } + + /** + * Get the authenticationType property: Specifies authentication type being used for connecting to the storage + * account. + * + * @return the authenticationType value. + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Specifies authentication type being used for connecting to the storage + * account. + * + * @param authenticationType the authenticationType value to set. + * @return the ExportDevicesRequest object itself. + */ + public ExportDevicesRequest withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the includeConfigurations property: The value indicating whether configurations should be exported. + * + * @return the includeConfigurations value. + */ + public Boolean includeConfigurations() { + return this.includeConfigurations; + } + + /** + * Set the includeConfigurations property: The value indicating whether configurations should be exported. + * + * @param includeConfigurations the includeConfigurations value to set. + * @return the ExportDevicesRequest object itself. + */ + public ExportDevicesRequest withIncludeConfigurations(Boolean includeConfigurations) { + this.includeConfigurations = includeConfigurations; + return this; + } + + /** + * Get the configurationsBlobName property: The name of the blob that will be created in the provided output blob + * container. This blob will contain the exported configurations for the Iot Hub. + * + * @return the configurationsBlobName value. + */ + public String configurationsBlobName() { + return this.configurationsBlobName; + } + + /** + * Set the configurationsBlobName property: The name of the blob that will be created in the provided output blob + * container. This blob will contain the exported configurations for the Iot Hub. + * + * @param configurationsBlobName the configurationsBlobName value to set. + * @return the ExportDevicesRequest object itself. + */ + public ExportDevicesRequest withConfigurationsBlobName(String configurationsBlobName) { + this.configurationsBlobName = configurationsBlobName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (exportBlobContainerUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property exportBlobContainerUri in model ExportDevicesRequest")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/FailoverInput.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/FailoverInput.java new file mode 100644 index 0000000000000..06c760ae618f0 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/FailoverInput.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.iothub.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; + +/** Use to provide failover region when requesting manual Failover for a hub. */ +@Fluent +public final class FailoverInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverInput.class); + + /* + * Region the hub will be failed over to + */ + @JsonProperty(value = "failoverRegion", required = true) + private String failoverRegion; + + /** + * Get the failoverRegion property: Region the hub will be failed over to. + * + * @return the failoverRegion value. + */ + public String failoverRegion() { + return this.failoverRegion; + } + + /** + * Set the failoverRegion property: Region the hub will be failed over to. + * + * @param failoverRegion the failoverRegion value to set. + * @return the FailoverInput object itself. + */ + public FailoverInput withFailoverRegion(String failoverRegion) { + this.failoverRegion = failoverRegion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (failoverRegion() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property failoverRegion in model FailoverInput")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/FallbackRouteProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/FallbackRouteProperties.java new file mode 100644 index 0000000000000..8b0cbc19c368d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/FallbackRouteProperties.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + */ +@Fluent +public final class FallbackRouteProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FallbackRouteProperties.class); + + /* + * The name of the route. The name can only include alphanumeric + * characters, periods, underscores, hyphens, has a maximum length of 64 + * characters, and must be unique. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The source to which the routing rule is to be applied to. For example, + * DeviceMessages + */ + @JsonProperty(value = "source", required = true) + private RoutingSource source; + + /* + * The condition which is evaluated in order to apply the fallback route. + * If the condition is not provided it will evaluate to true by default. + * For grammar, See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language + */ + @JsonProperty(value = "condition") + private String condition; + + /* + * The list of endpoints to which the messages that satisfy the condition + * are routed to. Currently only 1 endpoint is allowed. + */ + @JsonProperty(value = "endpointNames", required = true) + private List endpointNames; + + /* + * Used to specify whether the fallback route is enabled. + */ + @JsonProperty(value = "isEnabled", required = true) + private boolean isEnabled; + + /** + * Get the name property: The name of the route. The name can only include alphanumeric characters, periods, + * underscores, hyphens, has a maximum length of 64 characters, and must be unique. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the route. The name can only include alphanumeric characters, periods, + * underscores, hyphens, has a maximum length of 64 characters, and must be unique. + * + * @param name the name value to set. + * @return the FallbackRouteProperties object itself. + */ + public FallbackRouteProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the source property: The source to which the routing rule is to be applied to. For example, DeviceMessages. + * + * @return the source value. + */ + public RoutingSource source() { + return this.source; + } + + /** + * Set the source property: The source to which the routing rule is to be applied to. For example, DeviceMessages. + * + * @param source the source value to set. + * @return the FallbackRouteProperties object itself. + */ + public FallbackRouteProperties withSource(RoutingSource source) { + this.source = source; + return this; + } + + /** + * Get the condition property: The condition which is evaluated in order to apply the fallback route. If the + * condition is not provided it will evaluate to true by default. For grammar, See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + * + * @return the condition value. + */ + public String condition() { + return this.condition; + } + + /** + * Set the condition property: The condition which is evaluated in order to apply the fallback route. If the + * condition is not provided it will evaluate to true by default. For grammar, See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + * + * @param condition the condition value to set. + * @return the FallbackRouteProperties object itself. + */ + public FallbackRouteProperties withCondition(String condition) { + this.condition = condition; + return this; + } + + /** + * Get the endpointNames property: The list of endpoints to which the messages that satisfy the condition are routed + * to. Currently only 1 endpoint is allowed. + * + * @return the endpointNames value. + */ + public List endpointNames() { + return this.endpointNames; + } + + /** + * Set the endpointNames property: The list of endpoints to which the messages that satisfy the condition are routed + * to. Currently only 1 endpoint is allowed. + * + * @param endpointNames the endpointNames value to set. + * @return the FallbackRouteProperties object itself. + */ + public FallbackRouteProperties withEndpointNames(List endpointNames) { + this.endpointNames = endpointNames; + return this; + } + + /** + * Get the isEnabled property: Used to specify whether the fallback route is enabled. + * + * @return the isEnabled value. + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Used to specify whether the fallback route is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the FallbackRouteProperties object itself. + */ + public FallbackRouteProperties withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property source in model FallbackRouteProperties")); + } + if (endpointNames() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property endpointNames in model FallbackRouteProperties")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/FeedbackProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/FeedbackProperties.java new file mode 100644 index 0000000000000..30de8180f6e2b --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/FeedbackProperties.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.time.Duration; + +/** The properties of the feedback queue for cloud-to-device messages. */ +@Fluent +public final class FeedbackProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FeedbackProperties.class); + + /* + * The lock duration for the feedback queue. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + */ + @JsonProperty(value = "lockDurationAsIso8601") + private Duration lockDurationAsIso8601; + + /* + * The period of time for which a message is available to consume before it + * is expired by the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + */ + @JsonProperty(value = "ttlAsIso8601") + private Duration ttlAsIso8601; + + /* + * The number of times the IoT hub attempts to deliver a message on the + * feedback queue. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + */ + @JsonProperty(value = "maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * Get the lockDurationAsIso8601 property: The lock duration for the feedback queue. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + * + * @return the lockDurationAsIso8601 value. + */ + public Duration lockDurationAsIso8601() { + return this.lockDurationAsIso8601; + } + + /** + * Set the lockDurationAsIso8601 property: The lock duration for the feedback queue. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + * + * @param lockDurationAsIso8601 the lockDurationAsIso8601 value to set. + * @return the FeedbackProperties object itself. + */ + public FeedbackProperties withLockDurationAsIso8601(Duration lockDurationAsIso8601) { + this.lockDurationAsIso8601 = lockDurationAsIso8601; + return this; + } + + /** + * Get the ttlAsIso8601 property: The period of time for which a message is available to consume before it is + * expired by the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + * + * @return the ttlAsIso8601 value. + */ + public Duration ttlAsIso8601() { + return this.ttlAsIso8601; + } + + /** + * Set the ttlAsIso8601 property: The period of time for which a message is available to consume before it is + * expired by the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + * + * @param ttlAsIso8601 the ttlAsIso8601 value to set. + * @return the FeedbackProperties object itself. + */ + public FeedbackProperties withTtlAsIso8601(Duration ttlAsIso8601) { + this.ttlAsIso8601 = ttlAsIso8601; + return this; + } + + /** + * Get the maxDeliveryCount property: The number of times the IoT hub attempts to deliver a message on the feedback + * queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + * + * @return the maxDeliveryCount value. + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set the maxDeliveryCount property: The number of times the IoT hub attempts to deliver a message on the feedback + * queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + * + * @param maxDeliveryCount the maxDeliveryCount value to set. + * @return the FeedbackProperties object itself. + */ + public FeedbackProperties withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/GroupIdInformation.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/GroupIdInformation.java new file mode 100644 index 0000000000000..f13795f9e7f86 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.models; + +import com.azure.resourcemanager.iothub.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.iothub.fluent.models.GroupIdInformationInner object. + * + * @return the inner object. + */ + GroupIdInformationInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/GroupIdInformationProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/GroupIdInformationProperties.java new file mode 100644 index 0000000000000..797a9784c04b6 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ImportDevicesRequest.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ImportDevicesRequest.java new file mode 100644 index 0000000000000..abdf2d4966616 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ImportDevicesRequest.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** Use to provide parameters when requesting an import of all devices in the hub. */ +@Fluent +public final class ImportDevicesRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImportDevicesRequest.class); + + /* + * The input blob container URI. + */ + @JsonProperty(value = "inputBlobContainerUri", required = true) + private String inputBlobContainerUri; + + /* + * The output blob container URI. + */ + @JsonProperty(value = "outputBlobContainerUri", required = true) + private String outputBlobContainerUri; + + /* + * The blob name to be used when importing from the provided input blob + * container. + */ + @JsonProperty(value = "inputBlobName") + private String inputBlobName; + + /* + * The blob name to use for storing the status of the import job. + */ + @JsonProperty(value = "outputBlobName") + private String outputBlobName; + + /* + * Specifies authentication type being used for connecting to the storage + * account. + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /* + * The value indicating whether configurations should be imported. + */ + @JsonProperty(value = "includeConfigurations") + private Boolean includeConfigurations; + + /* + * The blob name to be used when importing configurations from the provided + * input blob container. + */ + @JsonProperty(value = "configurationsBlobName") + private String configurationsBlobName; + + /** + * Get the inputBlobContainerUri property: The input blob container URI. + * + * @return the inputBlobContainerUri value. + */ + public String inputBlobContainerUri() { + return this.inputBlobContainerUri; + } + + /** + * Set the inputBlobContainerUri property: The input blob container URI. + * + * @param inputBlobContainerUri the inputBlobContainerUri value to set. + * @return the ImportDevicesRequest object itself. + */ + public ImportDevicesRequest withInputBlobContainerUri(String inputBlobContainerUri) { + this.inputBlobContainerUri = inputBlobContainerUri; + return this; + } + + /** + * Get the outputBlobContainerUri property: The output blob container URI. + * + * @return the outputBlobContainerUri value. + */ + public String outputBlobContainerUri() { + return this.outputBlobContainerUri; + } + + /** + * Set the outputBlobContainerUri property: The output blob container URI. + * + * @param outputBlobContainerUri the outputBlobContainerUri value to set. + * @return the ImportDevicesRequest object itself. + */ + public ImportDevicesRequest withOutputBlobContainerUri(String outputBlobContainerUri) { + this.outputBlobContainerUri = outputBlobContainerUri; + return this; + } + + /** + * Get the inputBlobName property: The blob name to be used when importing from the provided input blob container. + * + * @return the inputBlobName value. + */ + public String inputBlobName() { + return this.inputBlobName; + } + + /** + * Set the inputBlobName property: The blob name to be used when importing from the provided input blob container. + * + * @param inputBlobName the inputBlobName value to set. + * @return the ImportDevicesRequest object itself. + */ + public ImportDevicesRequest withInputBlobName(String inputBlobName) { + this.inputBlobName = inputBlobName; + return this; + } + + /** + * Get the outputBlobName property: The blob name to use for storing the status of the import job. + * + * @return the outputBlobName value. + */ + public String outputBlobName() { + return this.outputBlobName; + } + + /** + * Set the outputBlobName property: The blob name to use for storing the status of the import job. + * + * @param outputBlobName the outputBlobName value to set. + * @return the ImportDevicesRequest object itself. + */ + public ImportDevicesRequest withOutputBlobName(String outputBlobName) { + this.outputBlobName = outputBlobName; + return this; + } + + /** + * Get the authenticationType property: Specifies authentication type being used for connecting to the storage + * account. + * + * @return the authenticationType value. + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Specifies authentication type being used for connecting to the storage + * account. + * + * @param authenticationType the authenticationType value to set. + * @return the ImportDevicesRequest object itself. + */ + public ImportDevicesRequest withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the includeConfigurations property: The value indicating whether configurations should be imported. + * + * @return the includeConfigurations value. + */ + public Boolean includeConfigurations() { + return this.includeConfigurations; + } + + /** + * Set the includeConfigurations property: The value indicating whether configurations should be imported. + * + * @param includeConfigurations the includeConfigurations value to set. + * @return the ImportDevicesRequest object itself. + */ + public ImportDevicesRequest withIncludeConfigurations(Boolean includeConfigurations) { + this.includeConfigurations = includeConfigurations; + return this; + } + + /** + * Get the configurationsBlobName property: The blob name to be used when importing configurations from the provided + * input blob container. + * + * @return the configurationsBlobName value. + */ + public String configurationsBlobName() { + return this.configurationsBlobName; + } + + /** + * Set the configurationsBlobName property: The blob name to be used when importing configurations from the provided + * input blob container. + * + * @param configurationsBlobName the configurationsBlobName value to set. + * @return the ImportDevicesRequest object itself. + */ + public ImportDevicesRequest withConfigurationsBlobName(String configurationsBlobName) { + this.configurationsBlobName = configurationsBlobName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (inputBlobContainerUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property inputBlobContainerUri in model ImportDevicesRequest")); + } + if (outputBlobContainerUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property outputBlobContainerUri in model ImportDevicesRequest")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubCapacity.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubCapacity.java new file mode 100644 index 0000000000000..3bbf578a85c61 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubCapacity.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** IoT Hub capacity information. */ +@Immutable +public final class IotHubCapacity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubCapacity.class); + + /* + * The minimum number of units. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Long minimum; + + /* + * The maximum number of units. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Long maximum; + + /* + * The default number of units. + */ + @JsonProperty(value = "default", access = JsonProperty.Access.WRITE_ONLY) + private Long defaultProperty; + + /* + * The type of the scaling enabled. + */ + @JsonProperty(value = "scaleType", access = JsonProperty.Access.WRITE_ONLY) + private IotHubScaleType scaleType; + + /** + * Get the minimum property: The minimum number of units. + * + * @return the minimum value. + */ + public Long minimum() { + return this.minimum; + } + + /** + * Get the maximum property: The maximum number of units. + * + * @return the maximum value. + */ + public Long maximum() { + return this.maximum; + } + + /** + * Get the defaultProperty property: The default number of units. + * + * @return the defaultProperty value. + */ + public Long defaultProperty() { + return this.defaultProperty; + } + + /** + * Get the scaleType property: The type of the scaling enabled. + * + * @return the scaleType value. + */ + public IotHubScaleType scaleType() { + return this.scaleType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubDescription.java new file mode 100644 index 0000000000000..8d583a60bfe20 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubDescription.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.iothub.fluent.models.IotHubDescriptionInner; +import java.util.Map; + +/** An immutable client-side representation of IotHubDescription. */ +public interface IotHubDescription { + /** + * 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: IotHub properties. + * + * @return the properties value. + */ + IotHubProperties properties(); + + /** + * Gets the sku property: IotHub SKU info. + * + * @return the sku value. + */ + IotHubSkuInfo sku(); + + /** + * 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.iothub.fluent.models.IotHubDescriptionInner object. + * + * @return the inner object. + */ + IotHubDescriptionInner innerModel(); + + /** The entirety of the IotHubDescription definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithSku, + DefinitionStages.WithCreate { + } + /** The IotHubDescription definition stages. */ + interface DefinitionStages { + /** The first stage of the IotHubDescription definition. */ + interface Blank extends WithLocation { + } + /** The stage of the IotHubDescription 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 IotHubDescription definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @return the next definition stage. + */ + WithSku withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the IotHubDescription definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: IotHub SKU info. + * + * @param sku IotHub SKU info. + * @return the next definition stage. + */ + WithCreate withSku(IotHubSkuInfo sku); + } + /** + * The stage of the IotHubDescription 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.WithProperties, + DefinitionStages.WithIfMatch { + /** + * Executes the create request. + * + * @return the created resource. + */ + IotHubDescription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + IotHubDescription create(Context context); + } + /** The stage of the IotHubDescription 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 IotHubDescription 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 IotHubDescription definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: IotHub properties. + * + * @param properties IotHub properties. + * @return the next definition stage. + */ + WithCreate withProperties(IotHubProperties properties); + } + /** The stage of the IotHubDescription definition allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. + * Required to update an existing IoT Hub.. + * + * @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update + * an existing IoT Hub. + * @return the next definition stage. + */ + WithCreate withIfMatch(String ifMatch); + } + } + /** + * Begins update for the IotHubDescription resource. + * + * @return the stage of resource update. + */ + IotHubDescription.Update update(); + + /** The template for IotHubDescription update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + IotHubDescription apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + IotHubDescription apply(Context context); + } + /** The IotHubDescription update stages. */ + interface UpdateStages { + /** The stage of the IotHubDescription 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. + */ + IotHubDescription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + IotHubDescription refresh(Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubDescriptionListResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubDescriptionListResult.java new file mode 100644 index 0000000000000..ea73613601856 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubDescriptionListResult.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.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.models.IotHubDescriptionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JSON-serialized array of IotHubDescription objects with a next link. */ +@Fluent +public final class IotHubDescriptionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubDescriptionListResult.class); + + /* + * The array of IotHubDescription objects. + */ + @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 array of IotHubDescription objects. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of IotHubDescription objects. + * + * @param value the value value to set. + * @return the IotHubDescriptionListResult object itself. + */ + public IotHubDescriptionListResult 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubLocationDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubLocationDescription.java new file mode 100644 index 0000000000000..b972ec0d8cb05 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubLocationDescription.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** Public representation of one of the locations where a resource is provisioned. */ +@Fluent +public final class IotHubLocationDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubLocationDescription.class); + + /* + * The name of the Azure region + */ + @JsonProperty(value = "location") + private String location; + + /* + * The role of the region, can be either primary or secondary. The primary + * region is where the IoT hub is currently provisioned. The secondary + * region is the Azure disaster recovery (DR) paired region and also the + * region where the IoT hub can failover to. + */ + @JsonProperty(value = "role") + private IotHubReplicaRoleType role; + + /** + * Get the location property: The name of the Azure region. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The name of the Azure region. + * + * @param location the location value to set. + * @return the IotHubLocationDescription object itself. + */ + public IotHubLocationDescription withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the role property: The role of the region, can be either primary or secondary. The primary region is where + * the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and + * also the region where the IoT hub can failover to. + * + * @return the role value. + */ + public IotHubReplicaRoleType role() { + return this.role; + } + + /** + * Set the role property: The role of the region, can be either primary or secondary. The primary region is where + * the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and + * also the region where the IoT hub can failover to. + * + * @param role the role value to set. + * @return the IotHubLocationDescription object itself. + */ + public IotHubLocationDescription withRole(IotHubReplicaRoleType role) { + this.role = role; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubNameAvailabilityInfo.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubNameAvailabilityInfo.java new file mode 100644 index 0000000000000..e73b9457b70ba --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubNameAvailabilityInfo.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.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.IotHubNameAvailabilityInfoInner; + +/** An immutable client-side representation of IotHubNameAvailabilityInfo. */ +public interface IotHubNameAvailabilityInfo { + /** + * Gets the nameAvailable property: The value which indicates whether the provided name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason for unavailability. + * + * @return the reason value. + */ + IotHubNameUnavailabilityReason reason(); + + /** + * Gets the message property: The detailed reason message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.IotHubNameAvailabilityInfoInner object. + * + * @return the inner object. + */ + IotHubNameAvailabilityInfoInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubNameUnavailabilityReason.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubNameUnavailabilityReason.java new file mode 100644 index 0000000000000..b159d17fdca78 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubNameUnavailabilityReason.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.iothub.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IotHubNameUnavailabilityReason. */ +public enum IotHubNameUnavailabilityReason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a IotHubNameUnavailabilityReason instance. */ + private final String value; + + IotHubNameUnavailabilityReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IotHubNameUnavailabilityReason instance. + * + * @param value the serialized value to parse. + * @return the parsed IotHubNameUnavailabilityReason object, or null if unable to parse. + */ + @JsonCreator + public static IotHubNameUnavailabilityReason fromString(String value) { + IotHubNameUnavailabilityReason[] items = IotHubNameUnavailabilityReason.values(); + for (IotHubNameUnavailabilityReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubProperties.java new file mode 100644 index 0000000000000..1a8baac9b4dae --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubProperties.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.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.iothub.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The properties of an IoT hub. */ +@Fluent +public final class IotHubProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubProperties.class); + + /* + * The shared access policies you can use to secure a connection to the IoT + * hub. + */ + @JsonProperty(value = "authorizationPolicies") + private List authorizationPolicies; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * The IP filter rules. + */ + @JsonProperty(value = "ipFilterRules") + private List ipFilterRules; + + /* + * Network Rule Set Properties of IotHub + */ + @JsonProperty(value = "networkRuleSets") + private NetworkRuleSetProperties networkRuleSets; + + /* + * Specifies the minimum TLS version to support for this hub. Can be set to + * "1.2" to have clients that use a TLS version below 1.2 to be rejected. + */ + @JsonProperty(value = "minTlsVersion") + private String minTlsVersion; + + /* + * Private endpoint connections created on this IotHub + */ + @JsonProperty(value = "privateEndpointConnections") + private List privateEndpointConnections; + + /* + * The provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The hub state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The name of the host. + */ + @JsonProperty(value = "hostName", access = JsonProperty.Access.WRITE_ONLY) + private String hostname; + + /* + * The Event Hub-compatible endpoint properties. The only possible keys to + * this dictionary is events. This key has to be present in the dictionary + * while making create or update calls for the IoT hub. + */ + @JsonProperty(value = "eventHubEndpoints") + private Map eventHubEndpoints; + + /* + * The routing related properties of the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging + */ + @JsonProperty(value = "routing") + private RoutingProperties routing; + + /* + * The list of Azure Storage endpoints where you can upload files. + * Currently you can configure only one Azure Storage account and that MUST + * have its key as $default. Specifying more than one storage account + * causes an error to be thrown. Not specifying a value for this property + * when the enableFileUploadNotifications property is set to True, causes + * an error to be thrown. + */ + @JsonProperty(value = "storageEndpoints") + private Map storageEndpoints; + + /* + * The messaging endpoint properties for the file upload notification + * queue. + */ + @JsonProperty(value = "messagingEndpoints") + private Map messagingEndpoints; + + /* + * If True, file upload notifications are enabled. + */ + @JsonProperty(value = "enableFileUploadNotifications") + private Boolean enableFileUploadNotifications; + + /* + * The IoT hub cloud-to-device messaging properties. + */ + @JsonProperty(value = "cloudToDevice") + private CloudToDeviceProperties cloudToDevice; + + /* + * IoT hub comments. + */ + @JsonProperty(value = "comments") + private String comments; + + /* + * The capabilities and features enabled for the IoT hub. + */ + @JsonProperty(value = "features") + private Capabilities features; + + /* + * Primary and secondary location for iot hub + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** + * Get the authorizationPolicies property: The shared access policies you can use to secure a connection to the IoT + * hub. + * + * @return the authorizationPolicies value. + */ + public List authorizationPolicies() { + return this.authorizationPolicies; + } + + /** + * Set the authorizationPolicies property: The shared access policies you can use to secure a connection to the IoT + * hub. + * + * @param authorizationPolicies the authorizationPolicies value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withAuthorizationPolicies( + List authorizationPolicies) { + this.authorizationPolicies = authorizationPolicies; + 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 IotHubProperties object itself. + */ + public IotHubProperties 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 IotHubProperties object itself. + */ + public IotHubProperties withIpFilterRules(List ipFilterRules) { + this.ipFilterRules = ipFilterRules; + return this; + } + + /** + * Get the networkRuleSets property: Network Rule Set Properties of IotHub. + * + * @return the networkRuleSets value. + */ + public NetworkRuleSetProperties networkRuleSets() { + return this.networkRuleSets; + } + + /** + * Set the networkRuleSets property: Network Rule Set Properties of IotHub. + * + * @param networkRuleSets the networkRuleSets value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withNetworkRuleSets(NetworkRuleSetProperties networkRuleSets) { + this.networkRuleSets = networkRuleSets; + return this; + } + + /** + * Get the minTlsVersion property: Specifies the minimum TLS version to support for this hub. Can be set to "1.2" to + * have clients that use a TLS version below 1.2 to be rejected. + * + * @return the minTlsVersion value. + */ + public String minTlsVersion() { + return this.minTlsVersion; + } + + /** + * Set the minTlsVersion property: Specifies the minimum TLS version to support for this hub. Can be set to "1.2" to + * have clients that use a TLS version below 1.2 to be rejected. + * + * @param minTlsVersion the minTlsVersion value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withMinTlsVersion(String minTlsVersion) { + this.minTlsVersion = minTlsVersion; + 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 IotHubProperties object itself. + */ + public IotHubProperties withPrivateEndpointConnections( + List privateEndpointConnections) { + this.privateEndpointConnections = privateEndpointConnections; + return this; + } + + /** + * Get the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the state property: The hub state. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the hostname property: The name of the host. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Get the eventHubEndpoints property: The Event Hub-compatible endpoint properties. The only possible keys to this + * dictionary is events. This key has to be present in the dictionary while making create or update calls for the + * IoT hub. + * + * @return the eventHubEndpoints value. + */ + public Map eventHubEndpoints() { + return this.eventHubEndpoints; + } + + /** + * Set the eventHubEndpoints property: The Event Hub-compatible endpoint properties. The only possible keys to this + * dictionary is events. This key has to be present in the dictionary while making create or update calls for the + * IoT hub. + * + * @param eventHubEndpoints the eventHubEndpoints value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withEventHubEndpoints(Map eventHubEndpoints) { + this.eventHubEndpoints = eventHubEndpoints; + return this; + } + + /** + * Get the routing property: The routing related properties of the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + * + * @return the routing value. + */ + public RoutingProperties routing() { + return this.routing; + } + + /** + * Set the routing property: The routing related properties of the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + * + * @param routing the routing value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withRouting(RoutingProperties routing) { + this.routing = routing; + return this; + } + + /** + * Get the storageEndpoints property: The list of Azure Storage endpoints where you can upload files. Currently you + * can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one + * storage account causes an error to be thrown. Not specifying a value for this property when the + * enableFileUploadNotifications property is set to True, causes an error to be thrown. + * + * @return the storageEndpoints value. + */ + public Map storageEndpoints() { + return this.storageEndpoints; + } + + /** + * Set the storageEndpoints property: The list of Azure Storage endpoints where you can upload files. Currently you + * can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one + * storage account causes an error to be thrown. Not specifying a value for this property when the + * enableFileUploadNotifications property is set to True, causes an error to be thrown. + * + * @param storageEndpoints the storageEndpoints value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withStorageEndpoints(Map storageEndpoints) { + this.storageEndpoints = storageEndpoints; + return this; + } + + /** + * Get the messagingEndpoints property: The messaging endpoint properties for the file upload notification queue. + * + * @return the messagingEndpoints value. + */ + public Map messagingEndpoints() { + return this.messagingEndpoints; + } + + /** + * Set the messagingEndpoints property: The messaging endpoint properties for the file upload notification queue. + * + * @param messagingEndpoints the messagingEndpoints value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withMessagingEndpoints(Map messagingEndpoints) { + this.messagingEndpoints = messagingEndpoints; + return this; + } + + /** + * Get the enableFileUploadNotifications property: If True, file upload notifications are enabled. + * + * @return the enableFileUploadNotifications value. + */ + public Boolean enableFileUploadNotifications() { + return this.enableFileUploadNotifications; + } + + /** + * Set the enableFileUploadNotifications property: If True, file upload notifications are enabled. + * + * @param enableFileUploadNotifications the enableFileUploadNotifications value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withEnableFileUploadNotifications(Boolean enableFileUploadNotifications) { + this.enableFileUploadNotifications = enableFileUploadNotifications; + return this; + } + + /** + * Get the cloudToDevice property: The IoT hub cloud-to-device messaging properties. + * + * @return the cloudToDevice value. + */ + public CloudToDeviceProperties cloudToDevice() { + return this.cloudToDevice; + } + + /** + * Set the cloudToDevice property: The IoT hub cloud-to-device messaging properties. + * + * @param cloudToDevice the cloudToDevice value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withCloudToDevice(CloudToDeviceProperties cloudToDevice) { + this.cloudToDevice = cloudToDevice; + return this; + } + + /** + * Get the comments property: IoT hub comments. + * + * @return the comments value. + */ + public String comments() { + return this.comments; + } + + /** + * Set the comments property: IoT hub comments. + * + * @param comments the comments value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withComments(String comments) { + this.comments = comments; + return this; + } + + /** + * Get the features property: The capabilities and features enabled for the IoT hub. + * + * @return the features value. + */ + public Capabilities features() { + return this.features; + } + + /** + * Set the features property: The capabilities and features enabled for the IoT hub. + * + * @param features the features value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withFeatures(Capabilities features) { + this.features = features; + return this; + } + + /** + * Get the locations property: Primary and secondary location for iot hub. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (authorizationPolicies() != null) { + authorizationPolicies().forEach(e -> e.validate()); + } + if (ipFilterRules() != null) { + ipFilterRules().forEach(e -> e.validate()); + } + if (networkRuleSets() != null) { + networkRuleSets().validate(); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (eventHubEndpoints() != null) { + eventHubEndpoints() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + if (routing() != null) { + routing().validate(); + } + if (storageEndpoints() != null) { + storageEndpoints() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + if (messagingEndpoints() != null) { + messagingEndpoints() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + if (cloudToDevice() != null) { + cloudToDevice().validate(); + } + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubQuotaMetricInfo.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubQuotaMetricInfo.java new file mode 100644 index 0000000000000..d8a257972709a --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubQuotaMetricInfo.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.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.IotHubQuotaMetricInfoInner; + +/** An immutable client-side representation of IotHubQuotaMetricInfo. */ +public interface IotHubQuotaMetricInfo { + /** + * Gets the name property: The name of the quota metric. + * + * @return the name value. + */ + String name(); + + /** + * Gets the currentValue property: The current value for the quota metric. + * + * @return the currentValue value. + */ + Long currentValue(); + + /** + * Gets the maxValue property: The maximum value of the quota metric. + * + * @return the maxValue value. + */ + Long maxValue(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.IotHubQuotaMetricInfoInner object. + * + * @return the inner object. + */ + IotHubQuotaMetricInfoInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubQuotaMetricInfoListResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubQuotaMetricInfoListResult.java new file mode 100644 index 0000000000000..726b2e0552479 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubQuotaMetricInfoListResult.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.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.models.IotHubQuotaMetricInfoInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. */ +@Fluent +public final class IotHubQuotaMetricInfoListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubQuotaMetricInfoListResult.class); + + /* + * The array of quota metrics objects. + */ + @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 array of quota metrics objects. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of quota metrics objects. + * + * @param value the value value to set. + * @return the IotHubQuotaMetricInfoListResult object itself. + */ + public IotHubQuotaMetricInfoListResult 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubReplicaRoleType.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubReplicaRoleType.java new file mode 100644 index 0000000000000..e20d1180a8be7 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubReplicaRoleType.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.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IotHubReplicaRoleType. */ +public final class IotHubReplicaRoleType extends ExpandableStringEnum { + /** Static value primary for IotHubReplicaRoleType. */ + public static final IotHubReplicaRoleType PRIMARY = fromString("primary"); + + /** Static value secondary for IotHubReplicaRoleType. */ + public static final IotHubReplicaRoleType SECONDARY = fromString("secondary"); + + /** + * Creates or finds a IotHubReplicaRoleType from its string representation. + * + * @param name a name to look for. + * @return the corresponding IotHubReplicaRoleType. + */ + @JsonCreator + public static IotHubReplicaRoleType fromString(String name) { + return fromString(name, IotHubReplicaRoleType.class); + } + + /** @return known IotHubReplicaRoleType values. */ + public static Collection values() { + return values(IotHubReplicaRoleType.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubResources.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubResources.java new file mode 100644 index 0000000000000..7508b995a125c --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubResources.java @@ -0,0 +1,716 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IotHubResources. */ +public interface IotHubResources { + /** + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 non-security related metadata of an IoT hub. + */ + IotHubDescription getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Get the non-security related metadata of an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 non-security related metadata of an IoT hub. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + IotHubDescription deleteByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Delete an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + IotHubDescription delete(String resourceGroupName, String resourceName, Context context); + + /** + * Get all the IoT hubs in a subscription. + * + * @throws com.azure.resourcemanager.iothub.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 IoT hubs in a subscription. + */ + PagedIterable list(); + + /** + * Get all the IoT hubs in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hubs in a subscription. + */ + PagedIterable list(Context context); + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hubs in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get all the IoT hubs in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hubs in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 statistics from an IoT hub. + */ + RegistryStatistics getStats(String resourceGroupName, String resourceName); + + /** + * Get the statistics from an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 statistics from an IoT hub. + */ + Response getStatsWithResponse(String resourceGroupName, String resourceName, Context context); + + /** + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 for an IoT hub. + */ + PagedIterable getValidSkus(String resourceGroupName, String resourceName); + + /** + * Get the list of valid SKUs for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 for an IoT hub. + */ + PagedIterable getValidSkus(String resourceGroupName, String resourceName, Context context); + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + */ + PagedIterable listEventHubConsumerGroups( + String resourceGroupName, String resourceName, String eventHubEndpointName); + + /** + * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + */ + PagedIterable listEventHubConsumerGroups( + String resourceGroupName, String resourceName, String eventHubEndpointName, Context context); + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + EventHubConsumerGroupInfo getEventHubConsumerGroup( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name); + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + Response getEventHubConsumerGroupWithResponse( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context); + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 deleteEventHubConsumerGroup( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name); + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. + * @param name The name of the consumer group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 deleteEventHubConsumerGroupWithResponse( + String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context); + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 the jobs in an IoT hub. + */ + PagedIterable listJobs(String resourceGroupName, String resourceName); + + /** + * Get a list of all the jobs in an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 the jobs in an IoT hub. + */ + PagedIterable listJobs(String resourceGroupName, String resourceName, Context context); + + /** + * Get the details of a job from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 details of a job from an IoT hub. + */ + JobResponse getJob(String resourceGroupName, String resourceName, String jobId); + + /** + * Get the details of a job from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param jobId The job identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 details of a job from an IoT hub. + */ + Response getJobWithResponse( + String resourceGroupName, String resourceName, String jobId, Context context); + + /** + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 quota metrics for an IoT hub. + */ + PagedIterable getQuotaMetrics(String resourceGroupName, String resourceName); + + /** + * Get the quota metrics for an IoT hub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 quota metrics for an IoT hub. + */ + PagedIterable getQuotaMetrics( + String resourceGroupName, String resourceName, Context context); + + /** + * Get the health for routing endpoints. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param iotHubName The iotHubName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 health for routing endpoints. + */ + PagedIterable getEndpointHealth(String resourceGroupName, String iotHubName); + + /** + * Get the health for routing endpoints. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param iotHubName The iotHubName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 health for routing endpoints. + */ + PagedIterable getEndpointHealth(String resourceGroupName, String iotHubName, Context context); + + /** + * Check if an IoT hub name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT hub to + * check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties indicating whether a given IoT hub name is available. + */ + IotHubNameAvailabilityInfo checkNameAvailability(OperationInputs operationInputs); + + /** + * Check if an IoT hub name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT hub to + * check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties indicating whether a given IoT hub name is available. + */ + Response checkNameAvailabilityWithResponse( + OperationInputs operationInputs, Context context); + + /** + * Test all routes configured in this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Input for testing all routes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 testing all routes. + */ + TestAllRoutesResult testAllRoutes(String iotHubName, String resourceGroupName, TestAllRoutesInput input); + + /** + * Test all routes configured in this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Input for testing all routes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 testing all routes. + */ + Response testAllRoutesWithResponse( + String iotHubName, String resourceGroupName, TestAllRoutesInput input, Context context); + + /** + * Test the new route for this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Route that needs to be tested. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 testing one route. + */ + TestRouteResult testRoute(String iotHubName, String resourceGroupName, TestRouteInput input); + + /** + * Test the new route for this Iot Hub. + * + * @param iotHubName IotHub to be tested. + * @param resourceGroupName resource group which Iot Hub belongs to. + * @param input Route that needs to be tested. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 testing one route. + */ + Response testRouteWithResponse( + String iotHubName, String resourceGroupName, TestRouteInput input, Context context); + + /** + * Get the security metadata for an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 security metadata for an IoT hub. + */ + PagedIterable listKeys(String resourceGroupName, String resourceName); + + /** + * Get the security metadata for an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 security metadata for an IoT hub. + */ + PagedIterable listKeys( + String resourceGroupName, String resourceName, Context context); + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 shared access policy by name from an IoT hub. + */ + SharedAccessSignatureAuthorizationRule getKeysForKeyName( + String resourceGroupName, String resourceName, String keyName); + + /** + * Get a shared access policy by name from an IoT hub. For more information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param keyName The name of the shared access policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 shared access policy by name from an IoT hub. + */ + Response getKeysForKeyNameWithResponse( + String resourceGroupName, String resourceName, String keyName, Context context); + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more + * information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties of the Job Response object. + */ + JobResponse exportDevices( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters); + + /** + * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more + * information, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param exportDevicesParameters The parameters that specify the export devices operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties of the Job Response object. + */ + Response exportDevicesWithResponse( + String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters, Context context); + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties of the Job Response object. + */ + JobResponse importDevices( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters); + + /** + * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param importDevicesParameters The parameters that specify the import devices operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 properties of the Job Response object. + */ + Response importDevicesWithResponse( + String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters, Context context); + + /** + * Get the non-security related metadata of an IoT hub. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 non-security related metadata of an IoT hub. + */ + IotHubDescription getById(String id); + + /** + * Get the non-security related metadata of an IoT hub. + * + * @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.iothub.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 non-security related metadata of an IoT hub. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + EventHubConsumerGroupInfo getEventHubConsumerGroupById(String id); + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @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.iothub.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 consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + Response getEventHubConsumerGroupByIdWithResponse(String id, Context context); + + /** + * Delete an IoT hub. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT hub. + */ + IotHubDescription deleteById(String id); + + /** + * Delete an IoT hub. + * + * @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.iothub.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 IoT hub. + */ + IotHubDescription deleteByIdWithResponse(String id, Context context); + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 deleteEventHubConsumerGroupById(String id); + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @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.iothub.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 deleteEventHubConsumerGroupByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new IotHubDescription resource. + * + * @param name resource name. + * @return the first stage of the new IotHubDescription definition. + */ + IotHubDescription.DefinitionStages.Blank define(String name); + + /** + * Begins definition for a new EventHubConsumerGroupInfo resource. + * + * @param name resource name. + * @return the first stage of the new EventHubConsumerGroupInfo definition. + */ + EventHubConsumerGroupInfo.DefinitionStages.Blank defineEventHubConsumerGroup(String name); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubScaleType.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubScaleType.java new file mode 100644 index 0000000000000..45cef96731d2f --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubScaleType.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.iothub.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IotHubScaleType. */ +public enum IotHubScaleType { + /** Enum value Automatic. */ + AUTOMATIC("Automatic"), + + /** Enum value Manual. */ + MANUAL("Manual"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a IotHubScaleType instance. */ + private final String value; + + IotHubScaleType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IotHubScaleType instance. + * + * @param value the serialized value to parse. + * @return the parsed IotHubScaleType object, or null if unable to parse. + */ + @JsonCreator + public static IotHubScaleType fromString(String value) { + IotHubScaleType[] items = IotHubScaleType.values(); + for (IotHubScaleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSku.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSku.java new file mode 100644 index 0000000000000..4ce828735e8f4 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSku.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IotHubSku. */ +public final class IotHubSku extends ExpandableStringEnum { + /** Static value F1 for IotHubSku. */ + public static final IotHubSku F1 = fromString("F1"); + + /** Static value S1 for IotHubSku. */ + public static final IotHubSku S1 = fromString("S1"); + + /** Static value S2 for IotHubSku. */ + public static final IotHubSku S2 = fromString("S2"); + + /** Static value S3 for IotHubSku. */ + public static final IotHubSku S3 = fromString("S3"); + + /** Static value B1 for IotHubSku. */ + public static final IotHubSku B1 = fromString("B1"); + + /** Static value B2 for IotHubSku. */ + public static final IotHubSku B2 = fromString("B2"); + + /** Static value B3 for IotHubSku. */ + public static final IotHubSku B3 = fromString("B3"); + + /** + * Creates or finds a IotHubSku from its string representation. + * + * @param name a name to look for. + * @return the corresponding IotHubSku. + */ + @JsonCreator + public static IotHubSku fromString(String name) { + return fromString(name, IotHubSku.class); + } + + /** @return known IotHubSku values. */ + public static Collection values() { + return values(IotHubSku.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuDescription.java new file mode 100644 index 0000000000000..7ad30f108025d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuDescription.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.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.IotHubSkuDescriptionInner; + +/** An immutable client-side representation of IotHubSkuDescription. */ +public interface IotHubSkuDescription { + /** + * Gets the resourceType property: The type of the resource. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the sku property: The type of the resource. + * + * @return the sku value. + */ + IotHubSkuInfo sku(); + + /** + * Gets the capacity property: IotHub capacity. + * + * @return the capacity value. + */ + IotHubCapacity capacity(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.IotHubSkuDescriptionInner object. + * + * @return the inner object. + */ + IotHubSkuDescriptionInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuDescriptionListResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuDescriptionListResult.java new file mode 100644 index 0000000000000..6fa6f0569cfca --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuDescriptionListResult.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.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.models.IotHubSkuDescriptionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JSON-serialized array of IotHubSkuDescription objects with a next link. */ +@Fluent +public final class IotHubSkuDescriptionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubSkuDescriptionListResult.class); + + /* + * The array of IotHubSkuDescription. + */ + @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 array of IotHubSkuDescription. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of IotHubSkuDescription. + * + * @param value the value value to set. + * @return the IotHubSkuDescriptionListResult object itself. + */ + public IotHubSkuDescriptionListResult 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuInfo.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuInfo.java new file mode 100644 index 0000000000000..565ca11e451e5 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuInfo.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** Information about the SKU of the IoT hub. */ +@Fluent +public final class IotHubSkuInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubSkuInfo.class); + + /* + * The name of the SKU. + */ + @JsonProperty(value = "name", required = true) + private IotHubSku name; + + /* + * The billing tier for the IoT hub. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private IotHubSkuTier tier; + + /* + * The number of provisioned IoT Hub units. See: + * https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + */ + @JsonProperty(value = "capacity") + private Long capacity; + + /** + * Get the name property: The name of the SKU. + * + * @return the name value. + */ + public IotHubSku name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. + * + * @param name the name value to set. + * @return the IotHubSkuInfo object itself. + */ + public IotHubSkuInfo withName(IotHubSku name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The billing tier for the IoT hub. + * + * @return the tier value. + */ + public IotHubSkuTier tier() { + return this.tier; + } + + /** + * Get the capacity property: The number of provisioned IoT Hub units. See: + * https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + * + * @return the capacity value. + */ + public Long capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The number of provisioned IoT Hub units. See: + * https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + * + * @param capacity the capacity value to set. + * @return the IotHubSkuInfo object itself. + */ + public IotHubSkuInfo withCapacity(Long capacity) { + this.capacity = capacity; + 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 IotHubSkuInfo")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuTier.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuTier.java new file mode 100644 index 0000000000000..4026747dba7ef --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubSkuTier.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.iothub.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IotHubSkuTier. */ +public enum IotHubSkuTier { + /** Enum value Free. */ + FREE("Free"), + + /** Enum value Standard. */ + STANDARD("Standard"), + + /** Enum value Basic. */ + BASIC("Basic"); + + /** The actual serialized value for a IotHubSkuTier instance. */ + private final String value; + + IotHubSkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IotHubSkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed IotHubSkuTier object, or null if unable to parse. + */ + @JsonCreator + public static IotHubSkuTier fromString(String value) { + IotHubSkuTier[] items = IotHubSkuTier.values(); + for (IotHubSkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubs.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubs.java new file mode 100644 index 0000000000000..6fc7ccd4a2572 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubs.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.util.Context; + +/** Resource collection API of IotHubs. */ +public interface IotHubs { + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 manualFailover(String iotHubName, String resourceGroupName, FailoverInput failoverInput); + + /** + * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + * https://aka.ms/manualfailover. + * + * @param iotHubName Name of the IoT hub to failover. + * @param resourceGroupName Name of the resource group containing the IoT hub resource. + * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the secondary + * location in the locations property. To learn more, see https://aka.ms/manualfailover/region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 manualFailover(String iotHubName, String resourceGroupName, FailoverInput failoverInput, Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IpFilterActionType.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IpFilterActionType.java new file mode 100644 index 0000000000000..c516c5cc8fc96 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IpFilterRule.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IpFilterRule.java new file mode 100644 index 0000000000000..dab0c96805860 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IpFilterRule.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 the IoT hub. */ +@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; + + /** + * 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; + } + + /** + * 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobResponse.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobResponse.java new file mode 100644 index 0000000000000..2033fb61aafef --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobResponse.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.JobResponseInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of JobResponse. */ +public interface JobResponse { + /** + * Gets the jobId property: The job identifier. + * + * @return the jobId value. + */ + String jobId(); + + /** + * Gets the startTimeUtc property: The start time of the job. + * + * @return the startTimeUtc value. + */ + OffsetDateTime startTimeUtc(); + + /** + * Gets the endTimeUtc property: The time the job stopped processing. + * + * @return the endTimeUtc value. + */ + OffsetDateTime endTimeUtc(); + + /** + * Gets the type property: The type of the job. + * + * @return the type value. + */ + JobType type(); + + /** + * Gets the status property: The status of the job. + * + * @return the status value. + */ + JobStatus status(); + + /** + * Gets the failureReason property: If status == failed, this string containing the reason for the failure. + * + * @return the failureReason value. + */ + String failureReason(); + + /** + * Gets the statusMessage property: The status message for the job. + * + * @return the statusMessage value. + */ + String statusMessage(); + + /** + * Gets the parentJobId property: The job identifier of the parent job, if any. + * + * @return the parentJobId value. + */ + String parentJobId(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.JobResponseInner object. + * + * @return the inner object. + */ + JobResponseInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobResponseListResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobResponseListResult.java new file mode 100644 index 0000000000000..5cb59afe7a7c5 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobResponseListResult.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.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.models.JobResponseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JSON-serialized array of JobResponse objects with a next link. */ +@Fluent +public final class JobResponseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobResponseListResult.class); + + /* + * The array of JobResponse objects. + */ + @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 array of JobResponse objects. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of JobResponse objects. + * + * @param value the value value to set. + * @return the JobResponseListResult object itself. + */ + public JobResponseListResult 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobStatus.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobStatus.java new file mode 100644 index 0000000000000..a69b024d3e26f --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobStatus.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for JobStatus. */ +public enum JobStatus { + /** Enum value unknown. */ + UNKNOWN("unknown"), + + /** Enum value enqueued. */ + ENQUEUED("enqueued"), + + /** Enum value running. */ + RUNNING("running"), + + /** Enum value completed. */ + COMPLETED("completed"), + + /** Enum value failed. */ + FAILED("failed"), + + /** Enum value cancelled. */ + CANCELLED("cancelled"); + + /** The actual serialized value for a JobStatus instance. */ + private final String value; + + JobStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed JobStatus object, or null if unable to parse. + */ + @JsonCreator + public static JobStatus fromString(String value) { + JobStatus[] items = JobStatus.values(); + for (JobStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobType.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobType.java new file mode 100644 index 0000000000000..566e3488e8578 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/JobType.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JobType. */ +public final class JobType extends ExpandableStringEnum { + /** Static value unknown for JobType. */ + public static final JobType UNKNOWN = fromString("unknown"); + + /** Static value export for JobType. */ + public static final JobType EXPORT = fromString("export"); + + /** Static value import for JobType. */ + public static final JobType IMPORT = fromString("import"); + + /** Static value backup for JobType. */ + public static final JobType BACKUP = fromString("backup"); + + /** Static value readDeviceProperties for JobType. */ + public static final JobType READ_DEVICE_PROPERTIES = fromString("readDeviceProperties"); + + /** Static value writeDeviceProperties for JobType. */ + public static final JobType WRITE_DEVICE_PROPERTIES = fromString("writeDeviceProperties"); + + /** Static value updateDeviceConfiguration for JobType. */ + public static final JobType UPDATE_DEVICE_CONFIGURATION = fromString("updateDeviceConfiguration"); + + /** Static value rebootDevice for JobType. */ + public static final JobType REBOOT_DEVICE = fromString("rebootDevice"); + + /** Static value factoryResetDevice for JobType. */ + public static final JobType FACTORY_RESET_DEVICE = fromString("factoryResetDevice"); + + /** Static value firmwareUpdate for JobType. */ + public static final JobType FIRMWARE_UPDATE = fromString("firmwareUpdate"); + + /** + * Creates or finds a JobType from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobType. + */ + @JsonCreator + public static JobType fromString(String name) { + return fromString(name, JobType.class); + } + + /** @return known JobType values. */ + public static Collection values() { + return values(JobType.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/MatchedRoute.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/MatchedRoute.java new file mode 100644 index 0000000000000..ae87e959e2dfa --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/MatchedRoute.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.iothub.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; + +/** Routes that matched. */ +@Fluent +public final class MatchedRoute { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MatchedRoute.class); + + /* + * Properties of routes that matched + */ + @JsonProperty(value = "properties") + private RouteProperties properties; + + /** + * Get the properties property: Properties of routes that matched. + * + * @return the properties value. + */ + public RouteProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of routes that matched. + * + * @param properties the properties value to set. + * @return the MatchedRoute object itself. + */ + public MatchedRoute withProperties(RouteProperties 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/MessagingEndpointProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/MessagingEndpointProperties.java new file mode 100644 index 0000000000000..2ffb5cb3995ce --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/MessagingEndpointProperties.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.time.Duration; + +/** The properties of the messaging endpoints used by this IoT hub. */ +@Fluent +public final class MessagingEndpointProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MessagingEndpointProperties.class); + + /* + * The lock duration. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + */ + @JsonProperty(value = "lockDurationAsIso8601") + private Duration lockDurationAsIso8601; + + /* + * The period of time for which a message is available to consume before it + * is expired by the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + */ + @JsonProperty(value = "ttlAsIso8601") + private Duration ttlAsIso8601; + + /* + * The number of times the IoT hub attempts to deliver a message. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + */ + @JsonProperty(value = "maxDeliveryCount") + private Integer maxDeliveryCount; + + /** + * Get the lockDurationAsIso8601 property: The lock duration. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + * + * @return the lockDurationAsIso8601 value. + */ + public Duration lockDurationAsIso8601() { + return this.lockDurationAsIso8601; + } + + /** + * Set the lockDurationAsIso8601 property: The lock duration. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + * + * @param lockDurationAsIso8601 the lockDurationAsIso8601 value to set. + * @return the MessagingEndpointProperties object itself. + */ + public MessagingEndpointProperties withLockDurationAsIso8601(Duration lockDurationAsIso8601) { + this.lockDurationAsIso8601 = lockDurationAsIso8601; + return this; + } + + /** + * Get the ttlAsIso8601 property: The period of time for which a message is available to consume before it is + * expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + * + * @return the ttlAsIso8601 value. + */ + public Duration ttlAsIso8601() { + return this.ttlAsIso8601; + } + + /** + * Set the ttlAsIso8601 property: The period of time for which a message is available to consume before it is + * expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + * + * @param ttlAsIso8601 the ttlAsIso8601 value to set. + * @return the MessagingEndpointProperties object itself. + */ + public MessagingEndpointProperties withTtlAsIso8601(Duration ttlAsIso8601) { + this.ttlAsIso8601 = ttlAsIso8601; + return this; + } + + /** + * Get the maxDeliveryCount property: The number of times the IoT hub attempts to deliver a message. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + * + * @return the maxDeliveryCount value. + */ + public Integer maxDeliveryCount() { + return this.maxDeliveryCount; + } + + /** + * Set the maxDeliveryCount property: The number of times the IoT hub attempts to deliver a message. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + * + * @param maxDeliveryCount the maxDeliveryCount value to set. + * @return the MessagingEndpointProperties object itself. + */ + public MessagingEndpointProperties withMaxDeliveryCount(Integer maxDeliveryCount) { + this.maxDeliveryCount = maxDeliveryCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Name.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Name.java new file mode 100644 index 0000000000000..d2a207582c131 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Name.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** Name of Iot Hub type. */ +@Fluent +public final class Name { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Name.class); + + /* + * IotHub type + */ + @JsonProperty(value = "value") + private String value; + + /* + * Localized value of name + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the value property: IotHub type. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: IotHub type. + * + * @param value the value value to set. + * @return the Name object itself. + */ + public Name withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: Localized value of name. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: Localized value of name. + * + * @param localizedValue the localizedValue value to set. + * @return the Name object itself. + */ + public Name withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleIpAction.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleIpAction.java new file mode 100644 index 0000000000000..1f4cf94b56bac --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleIpAction.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.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NetworkRuleIpAction. */ +public final class NetworkRuleIpAction extends ExpandableStringEnum { + /** Static value Allow for NetworkRuleIpAction. */ + public static final NetworkRuleIpAction ALLOW = fromString("Allow"); + + /** + * Creates or finds a NetworkRuleIpAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkRuleIpAction. + */ + @JsonCreator + public static NetworkRuleIpAction fromString(String name) { + return fromString(name, NetworkRuleIpAction.class); + } + + /** @return known NetworkRuleIpAction values. */ + public static Collection values() { + return values(NetworkRuleIpAction.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetIpRule.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetIpRule.java new file mode 100644 index 0000000000000..420a12f6ab9fb --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetIpRule.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** IP Rule to be applied as part of Network Rule Set. */ +@Fluent +public final class NetworkRuleSetIpRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkRuleSetIpRule.class); + + /* + * Name of the IP filter rule. + */ + @JsonProperty(value = "filterName", required = true) + private String filterName; + + /* + * IP Filter Action + */ + @JsonProperty(value = "action") + private NetworkRuleIpAction action; + + /* + * A string that contains the IP address range in CIDR notation for the + * rule. + */ + @JsonProperty(value = "ipMask", required = true) + private String ipMask; + + /** + * Get the filterName property: Name of the IP filter rule. + * + * @return the filterName value. + */ + public String filterName() { + return this.filterName; + } + + /** + * Set the filterName property: Name of the IP filter rule. + * + * @param filterName the filterName value to set. + * @return the NetworkRuleSetIpRule object itself. + */ + public NetworkRuleSetIpRule withFilterName(String filterName) { + this.filterName = filterName; + return this; + } + + /** + * Get the action property: IP Filter Action. + * + * @return the action value. + */ + public NetworkRuleIpAction action() { + return this.action; + } + + /** + * Set the action property: IP Filter Action. + * + * @param action the action value to set. + * @return the NetworkRuleSetIpRule object itself. + */ + public NetworkRuleSetIpRule withAction(NetworkRuleIpAction 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 NetworkRuleSetIpRule object itself. + */ + public NetworkRuleSetIpRule withIpMask(String ipMask) { + this.ipMask = ipMask; + 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 NetworkRuleSetIpRule")); + } + if (ipMask() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property ipMask in model NetworkRuleSetIpRule")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetProperties.java new file mode 100644 index 0000000000000..7121e4d7c4d00 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetProperties.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.iothub.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; + +/** Network Rule Set Properties of IotHub. */ +@Fluent +public final class NetworkRuleSetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkRuleSetProperties.class); + + /* + * Default Action for Network Rule Set + */ + @JsonProperty(value = "defaultAction") + private DefaultAction defaultAction; + + /* + * If True, then Network Rule Set is also applied to BuiltIn EventHub + * EndPoint of IotHub + */ + @JsonProperty(value = "applyToBuiltInEventHubEndpoint", required = true) + private boolean applyToBuiltInEventHubEndpoint; + + /* + * List of IP Rules + */ + @JsonProperty(value = "ipRules", required = true) + private List ipRules; + + /** + * Get the defaultAction property: Default Action for Network Rule Set. + * + * @return the defaultAction value. + */ + public DefaultAction defaultAction() { + return this.defaultAction; + } + + /** + * Set the defaultAction property: Default Action for Network Rule Set. + * + * @param defaultAction the defaultAction value to set. + * @return the NetworkRuleSetProperties object itself. + */ + public NetworkRuleSetProperties withDefaultAction(DefaultAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get the applyToBuiltInEventHubEndpoint property: If True, then Network Rule Set is also applied to BuiltIn + * EventHub EndPoint of IotHub. + * + * @return the applyToBuiltInEventHubEndpoint value. + */ + public boolean applyToBuiltInEventHubEndpoint() { + return this.applyToBuiltInEventHubEndpoint; + } + + /** + * Set the applyToBuiltInEventHubEndpoint property: If True, then Network Rule Set is also applied to BuiltIn + * EventHub EndPoint of IotHub. + * + * @param applyToBuiltInEventHubEndpoint the applyToBuiltInEventHubEndpoint value to set. + * @return the NetworkRuleSetProperties object itself. + */ + public NetworkRuleSetProperties withApplyToBuiltInEventHubEndpoint(boolean applyToBuiltInEventHubEndpoint) { + this.applyToBuiltInEventHubEndpoint = applyToBuiltInEventHubEndpoint; + return this; + } + + /** + * Get the ipRules property: List of IP Rules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: List of IP Rules. + * + * @param ipRules the ipRules value to set. + * @return the NetworkRuleSetProperties object itself. + */ + public NetworkRuleSetProperties withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipRules() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property ipRules in model NetworkRuleSetProperties")); + } else { + ipRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Operation.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Operation.java new file mode 100644 index 0000000000000..d651bc8f863ca --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.models; + +import com.azure.resourcemanager.iothub.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.iothub.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/OperationDisplay.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/OperationDisplay.java new file mode 100644 index 0000000000000..2f853034b9591 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/OperationDisplay.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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: IotHubs + */ + @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; + + /* + * Description of the operation + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: Service provider: Microsoft Devices. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: Resource Type: IotHubs. + * + * @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; + } + + /** + * Get the description property: Description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/OperationInputs.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/OperationInputs.java new file mode 100644 index 0000000000000..6ac998cf03157 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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. */ +@Fluent +public final class OperationInputs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInputs.class); + + /* + * The name of the IoT hub to check. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the name property: The name of the IoT hub to check. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the IoT hub 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/OperationListResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/OperationListResult.java new file mode 100644 index 0000000000000..34cd8e8df472d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.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 IoT Hub 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); + + /* + * List of IoT Hub 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: List of IoT Hub 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Operations.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/Operations.java new file mode 100644 index 0000000000000..e98e0d01a2d62 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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 IoT Hub REST API operations. + * + * @throws com.azure.resourcemanager.iothub.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 IoT Hub operations. + */ + PagedIterable list(); + + /** + * Lists all of the available IoT Hub REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IoT Hub operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateEndpoint.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateEndpoint.java new file mode 100644 index 0000000000000..b0e77d065aea2 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateEndpointConnection.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..6f5866b5c1208 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateEndpointConnection.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.iothub.models; + +import com.azure.resourcemanager.iothub.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.iothub.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateEndpointConnectionProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..668c980a2e633 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateEndpointConnections.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..33df90f3b7210 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateEndpointConnections.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.iothub.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.iothub.fluent.models.PrivateEndpointConnectionInner; +import java.util.List; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + List list(String resourceGroupName, String resourceName); + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + Response> listWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 get(String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 getWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 an IotHub. + */ + PrivateEndpointConnection update( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 an IotHub. + */ + PrivateEndpointConnection update( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + PrivateEndpointConnection delete( + 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 IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 an IotHub. + */ + PrivateEndpointConnection delete( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateLinkResources.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..02168d3d4d7de --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateLinkResources.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.iothub.models; + +import com.azure.resourcemanager.iothub.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 an IotHub. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.PrivateLinkResourcesInner object. + * + * @return the inner object. + */ + PrivateLinkResourcesInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateLinkResourcesOperations.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateLinkResourcesOperations.java new file mode 100644 index 0000000000000..10bcccda4fa11 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateLinkResourcesOperations.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkResourcesOperations. */ +public interface PrivateLinkResourcesOperations { + /** + * List private link resources for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + PrivateLinkResources list(String resourceGroupName, String resourceName); + + /** + * List private link resources for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 an IotHub. + */ + Response listWithResponse(String resourceGroupName, String resourceName, Context context); + + /** + * Get the specified private link resource for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 IotHub. + */ + GroupIdInformation get(String resourceGroupName, String resourceName, String groupId); + + /** + * Get the specified private link resource for the given IotHub. + * + * @param resourceGroupName The name of the resource group that contains the IoT hub. + * @param resourceName The name of the IoT hub. + * @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.iothub.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 IotHub. + */ + Response getWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateLinkServiceConnectionState.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 0000000000000..26044dc0415a9 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateLinkServiceConnectionStatus.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PrivateLinkServiceConnectionStatus.java new file mode 100644 index 0000000000000..9a7a9e618533b --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PublicNetworkAccess.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/PublicNetworkAccess.java new file mode 100644 index 0000000000000..337473236a4f3 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RegistryStatistics.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RegistryStatistics.java new file mode 100644 index 0000000000000..fcdd479777365 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RegistryStatistics.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.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.RegistryStatisticsInner; + +/** An immutable client-side representation of RegistryStatistics. */ +public interface RegistryStatistics { + /** + * Gets the totalDeviceCount property: The total count of devices in the identity registry. + * + * @return the totalDeviceCount value. + */ + Long totalDeviceCount(); + + /** + * Gets the enabledDeviceCount property: The count of enabled devices in the identity registry. + * + * @return the enabledDeviceCount value. + */ + Long enabledDeviceCount(); + + /** + * Gets the disabledDeviceCount property: The count of disabled devices in the identity registry. + * + * @return the disabledDeviceCount value. + */ + Long disabledDeviceCount(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.RegistryStatisticsInner object. + * + * @return the inner object. + */ + RegistryStatisticsInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ResourceProviderCommons.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ResourceProviderCommons.java new file mode 100644 index 0000000000000..8e1318a054f43 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ResourceProviderCommons.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.iothub.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviderCommons. */ +public interface ResourceProviderCommons { + /** + * Get the number of free and paid iot hubs in the subscription. + * + * @throws com.azure.resourcemanager.iothub.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 number of free and paid iot hubs in the subscription. + */ + UserSubscriptionQuotaListResult getSubscriptionQuota(); + + /** + * Get the number of free and paid iot hubs in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.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 number of free and paid iot hubs in the subscription. + */ + Response getSubscriptionQuotaWithResponse(Context context); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteCompilationError.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteCompilationError.java new file mode 100644 index 0000000000000..40097484499ae --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteCompilationError.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** Compilation error when evaluating route. */ +@Fluent +public final class RouteCompilationError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RouteCompilationError.class); + + /* + * Route error message + */ + @JsonProperty(value = "message") + private String message; + + /* + * Severity of the route error + */ + @JsonProperty(value = "severity") + private RouteErrorSeverity severity; + + /* + * Location where the route error happened + */ + @JsonProperty(value = "location") + private RouteErrorRange location; + + /** + * Get the message property: Route error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Route error message. + * + * @param message the message value to set. + * @return the RouteCompilationError object itself. + */ + public RouteCompilationError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the severity property: Severity of the route error. + * + * @return the severity value. + */ + public RouteErrorSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: Severity of the route error. + * + * @param severity the severity value to set. + * @return the RouteCompilationError object itself. + */ + public RouteCompilationError withSeverity(RouteErrorSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the location property: Location where the route error happened. + * + * @return the location value. + */ + public RouteErrorRange location() { + return this.location; + } + + /** + * Set the location property: Location where the route error happened. + * + * @param location the location value to set. + * @return the RouteCompilationError object itself. + */ + public RouteCompilationError withLocation(RouteErrorRange location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (location() != null) { + location().validate(); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteErrorPosition.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteErrorPosition.java new file mode 100644 index 0000000000000..2fff04210d8c3 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteErrorPosition.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** Position where the route error happened. */ +@Fluent +public final class RouteErrorPosition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RouteErrorPosition.class); + + /* + * Line where the route error happened + */ + @JsonProperty(value = "line") + private Integer line; + + /* + * Column where the route error happened + */ + @JsonProperty(value = "column") + private Integer column; + + /** + * Get the line property: Line where the route error happened. + * + * @return the line value. + */ + public Integer line() { + return this.line; + } + + /** + * Set the line property: Line where the route error happened. + * + * @param line the line value to set. + * @return the RouteErrorPosition object itself. + */ + public RouteErrorPosition withLine(Integer line) { + this.line = line; + return this; + } + + /** + * Get the column property: Column where the route error happened. + * + * @return the column value. + */ + public Integer column() { + return this.column; + } + + /** + * Set the column property: Column where the route error happened. + * + * @param column the column value to set. + * @return the RouteErrorPosition object itself. + */ + public RouteErrorPosition withColumn(Integer column) { + this.column = column; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteErrorRange.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteErrorRange.java new file mode 100644 index 0000000000000..ffb314cf5039a --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteErrorRange.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** Range of route errors. */ +@Fluent +public final class RouteErrorRange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RouteErrorRange.class); + + /* + * Start where the route error happened + */ + @JsonProperty(value = "start") + private RouteErrorPosition start; + + /* + * End where the route error happened + */ + @JsonProperty(value = "end") + private RouteErrorPosition end; + + /** + * Get the start property: Start where the route error happened. + * + * @return the start value. + */ + public RouteErrorPosition start() { + return this.start; + } + + /** + * Set the start property: Start where the route error happened. + * + * @param start the start value to set. + * @return the RouteErrorRange object itself. + */ + public RouteErrorRange withStart(RouteErrorPosition start) { + this.start = start; + return this; + } + + /** + * Get the end property: End where the route error happened. + * + * @return the end value. + */ + public RouteErrorPosition end() { + return this.end; + } + + /** + * Set the end property: End where the route error happened. + * + * @param end the end value to set. + * @return the RouteErrorRange object itself. + */ + public RouteErrorRange withEnd(RouteErrorPosition end) { + this.end = end; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (start() != null) { + start().validate(); + } + if (end() != null) { + end().validate(); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteErrorSeverity.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteErrorSeverity.java new file mode 100644 index 0000000000000..79a8835ddac22 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteErrorSeverity.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.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RouteErrorSeverity. */ +public final class RouteErrorSeverity extends ExpandableStringEnum { + /** Static value error for RouteErrorSeverity. */ + public static final RouteErrorSeverity ERROR = fromString("error"); + + /** Static value warning for RouteErrorSeverity. */ + public static final RouteErrorSeverity WARNING = fromString("warning"); + + /** + * Creates or finds a RouteErrorSeverity from its string representation. + * + * @param name a name to look for. + * @return the corresponding RouteErrorSeverity. + */ + @JsonCreator + public static RouteErrorSeverity fromString(String name) { + return fromString(name, RouteErrorSeverity.class); + } + + /** @return known RouteErrorSeverity values. */ + public static Collection values() { + return values(RouteErrorSeverity.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteProperties.java new file mode 100644 index 0000000000000..55994f08e91b4 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RouteProperties.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.iothub.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 of a routing rule that your IoT hub uses to route messages to endpoints. */ +@Fluent +public final class RouteProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RouteProperties.class); + + /* + * The name of the route. The name can only include alphanumeric + * characters, periods, underscores, hyphens, has a maximum length of 64 + * characters, and must be unique. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The source that the routing rule is to be applied to, such as + * DeviceMessages. + */ + @JsonProperty(value = "source", required = true) + private RoutingSource source; + + /* + * The condition that is evaluated to apply the routing rule. If no + * condition is provided, it evaluates to true by default. For grammar, + * see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language + */ + @JsonProperty(value = "condition") + private String condition; + + /* + * The list of endpoints to which messages that satisfy the condition are + * routed. Currently only one endpoint is allowed. + */ + @JsonProperty(value = "endpointNames", required = true) + private List endpointNames; + + /* + * Used to specify whether a route is enabled. + */ + @JsonProperty(value = "isEnabled", required = true) + private boolean isEnabled; + + /** + * Get the name property: The name of the route. The name can only include alphanumeric characters, periods, + * underscores, hyphens, has a maximum length of 64 characters, and must be unique. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the route. The name can only include alphanumeric characters, periods, + * underscores, hyphens, has a maximum length of 64 characters, and must be unique. + * + * @param name the name value to set. + * @return the RouteProperties object itself. + */ + public RouteProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the source property: The source that the routing rule is to be applied to, such as DeviceMessages. + * + * @return the source value. + */ + public RoutingSource source() { + return this.source; + } + + /** + * Set the source property: The source that the routing rule is to be applied to, such as DeviceMessages. + * + * @param source the source value to set. + * @return the RouteProperties object itself. + */ + public RouteProperties withSource(RoutingSource source) { + this.source = source; + return this; + } + + /** + * Get the condition property: The condition that is evaluated to apply the routing rule. If no condition is + * provided, it evaluates to true by default. For grammar, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + * + * @return the condition value. + */ + public String condition() { + return this.condition; + } + + /** + * Set the condition property: The condition that is evaluated to apply the routing rule. If no condition is + * provided, it evaluates to true by default. For grammar, see: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + * + * @param condition the condition value to set. + * @return the RouteProperties object itself. + */ + public RouteProperties withCondition(String condition) { + this.condition = condition; + return this; + } + + /** + * Get the endpointNames property: The list of endpoints to which messages that satisfy the condition are routed. + * Currently only one endpoint is allowed. + * + * @return the endpointNames value. + */ + public List endpointNames() { + return this.endpointNames; + } + + /** + * Set the endpointNames property: The list of endpoints to which messages that satisfy the condition are routed. + * Currently only one endpoint is allowed. + * + * @param endpointNames the endpointNames value to set. + * @return the RouteProperties object itself. + */ + public RouteProperties withEndpointNames(List endpointNames) { + this.endpointNames = endpointNames; + return this; + } + + /** + * Get the isEnabled property: Used to specify whether a route is enabled. + * + * @return the isEnabled value. + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Used to specify whether a route is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the RouteProperties object itself. + */ + public RouteProperties withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + 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 RouteProperties")); + } + if (source() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property source in model RouteProperties")); + } + if (endpointNames() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property endpointNames in model RouteProperties")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEndpoints.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEndpoints.java new file mode 100644 index 0000000000000..f93098ac15385 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEndpoints.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A + * maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is + * allowed across all endpoint types for free hubs. + */ +@Fluent +public final class RoutingEndpoints { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoutingEndpoints.class); + + /* + * The list of Service Bus queue endpoints that IoT hub routes the messages + * to, based on the routing rules. + */ + @JsonProperty(value = "serviceBusQueues") + private List serviceBusQueues; + + /* + * The list of Service Bus topic endpoints that the IoT hub routes the + * messages to, based on the routing rules. + */ + @JsonProperty(value = "serviceBusTopics") + private List serviceBusTopics; + + /* + * The list of Event Hubs endpoints that IoT hub routes messages to, based + * on the routing rules. This list does not include the built-in Event Hubs + * endpoint. + */ + @JsonProperty(value = "eventHubs") + private List eventHubs; + + /* + * The list of storage container endpoints that IoT hub routes messages to, + * based on the routing rules. + */ + @JsonProperty(value = "storageContainers") + private List storageContainers; + + /** + * Get the serviceBusQueues property: The list of Service Bus queue endpoints that IoT hub routes the messages to, + * based on the routing rules. + * + * @return the serviceBusQueues value. + */ + public List serviceBusQueues() { + return this.serviceBusQueues; + } + + /** + * Set the serviceBusQueues property: The list of Service Bus queue endpoints that IoT hub routes the messages to, + * based on the routing rules. + * + * @param serviceBusQueues the serviceBusQueues value to set. + * @return the RoutingEndpoints object itself. + */ + public RoutingEndpoints withServiceBusQueues(List serviceBusQueues) { + this.serviceBusQueues = serviceBusQueues; + return this; + } + + /** + * Get the serviceBusTopics property: The list of Service Bus topic endpoints that the IoT hub routes the messages + * to, based on the routing rules. + * + * @return the serviceBusTopics value. + */ + public List serviceBusTopics() { + return this.serviceBusTopics; + } + + /** + * Set the serviceBusTopics property: The list of Service Bus topic endpoints that the IoT hub routes the messages + * to, based on the routing rules. + * + * @param serviceBusTopics the serviceBusTopics value to set. + * @return the RoutingEndpoints object itself. + */ + public RoutingEndpoints withServiceBusTopics(List serviceBusTopics) { + this.serviceBusTopics = serviceBusTopics; + return this; + } + + /** + * Get the eventHubs property: The list of Event Hubs endpoints that IoT hub routes messages to, based on the + * routing rules. This list does not include the built-in Event Hubs endpoint. + * + * @return the eventHubs value. + */ + public List eventHubs() { + return this.eventHubs; + } + + /** + * Set the eventHubs property: The list of Event Hubs endpoints that IoT hub routes messages to, based on the + * routing rules. This list does not include the built-in Event Hubs endpoint. + * + * @param eventHubs the eventHubs value to set. + * @return the RoutingEndpoints object itself. + */ + public RoutingEndpoints withEventHubs(List eventHubs) { + this.eventHubs = eventHubs; + return this; + } + + /** + * Get the storageContainers property: The list of storage container endpoints that IoT hub routes messages to, + * based on the routing rules. + * + * @return the storageContainers value. + */ + public List storageContainers() { + return this.storageContainers; + } + + /** + * Set the storageContainers property: The list of storage container endpoints that IoT hub routes messages to, + * based on the routing rules. + * + * @param storageContainers the storageContainers value to set. + * @return the RoutingEndpoints object itself. + */ + public RoutingEndpoints withStorageContainers(List storageContainers) { + this.storageContainers = storageContainers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceBusQueues() != null) { + serviceBusQueues().forEach(e -> e.validate()); + } + if (serviceBusTopics() != null) { + serviceBusTopics().forEach(e -> e.validate()); + } + if (eventHubs() != null) { + eventHubs().forEach(e -> e.validate()); + } + if (storageContainers() != null) { + storageContainers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEventHubProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEventHubProperties.java new file mode 100644 index 0000000000000..857d7ac7bf297 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEventHubProperties.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 related to an event hub endpoint. */ +@Fluent +public final class RoutingEventHubProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoutingEventHubProperties.class); + + /* + * Id of the event hub endpoint + */ + @JsonProperty(value = "id") + private String id; + + /* + * The connection string of the event hub endpoint. + */ + @JsonProperty(value = "connectionString") + private String connectionString; + + /* + * The url of the event hub endpoint. It must include the protocol sb:// + */ + @JsonProperty(value = "endpointUri") + private String endpointUri; + + /* + * Event hub name on the event hub namespace + */ + @JsonProperty(value = "entityPath") + private String entityPath; + + /* + * Method used to authenticate against the event hub endpoint + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /* + * The name that identifies this endpoint. The name can only include + * alphanumeric characters, periods, underscores, hyphens and has a maximum + * length of 64 characters. The following names are reserved: events, + * fileNotifications, $default. Endpoint names must be unique across + * endpoint types. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The subscription identifier of the event hub endpoint. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * The name of the resource group of the event hub endpoint. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * Get the id property: Id of the event hub endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Id of the event hub endpoint. + * + * @param id the id value to set. + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Get the connectionString property: The connection string of the event hub endpoint. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: The connection string of the event hub endpoint. + * + * @param connectionString the connectionString value to set. + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the endpointUri property: The url of the event hub endpoint. It must include the protocol sb://. + * + * @return the endpointUri value. + */ + public String endpointUri() { + return this.endpointUri; + } + + /** + * Set the endpointUri property: The url of the event hub endpoint. It must include the protocol sb://. + * + * @param endpointUri the endpointUri value to set. + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withEndpointUri(String endpointUri) { + this.endpointUri = endpointUri; + return this; + } + + /** + * Get the entityPath property: Event hub name on the event hub namespace. + * + * @return the entityPath value. + */ + public String entityPath() { + return this.entityPath; + } + + /** + * Set the entityPath property: Event hub name on the event hub namespace. + * + * @param entityPath the entityPath value to set. + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withEntityPath(String entityPath) { + this.entityPath = entityPath; + return this; + } + + /** + * Get the authenticationType property: Method used to authenticate against the event hub endpoint. + * + * @return the authenticationType value. + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Method used to authenticate against the event hub endpoint. + * + * @param authenticationType the authenticationType value to set. + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, + * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: + * events, fileNotifications, $default. Endpoint names must be unique across endpoint types. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, + * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: + * events, fileNotifications, $default. Endpoint names must be unique across endpoint types. + * + * @param name the name value to set. + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the subscriptionId property: The subscription identifier of the event hub endpoint. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription identifier of the event hub endpoint. + * + * @param subscriptionId the subscriptionId value to set. + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup property: The name of the resource group of the event hub endpoint. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup property: The name of the resource group of the event hub endpoint. + * + * @param resourceGroup the resourceGroup value to set. + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + 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 RoutingEventHubProperties")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingMessage.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingMessage.java new file mode 100644 index 0000000000000..f91d7887c2574 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingMessage.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.iothub.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; + +/** Routing message. */ +@Fluent +public final class RoutingMessage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoutingMessage.class); + + /* + * Body of routing message + */ + @JsonProperty(value = "body") + private String body; + + /* + * App properties + */ + @JsonProperty(value = "appProperties") + private Map appProperties; + + /* + * System properties + */ + @JsonProperty(value = "systemProperties") + private Map systemProperties; + + /** + * Get the body property: Body of routing message. + * + * @return the body value. + */ + public String body() { + return this.body; + } + + /** + * Set the body property: Body of routing message. + * + * @param body the body value to set. + * @return the RoutingMessage object itself. + */ + public RoutingMessage withBody(String body) { + this.body = body; + return this; + } + + /** + * Get the appProperties property: App properties. + * + * @return the appProperties value. + */ + public Map appProperties() { + return this.appProperties; + } + + /** + * Set the appProperties property: App properties. + * + * @param appProperties the appProperties value to set. + * @return the RoutingMessage object itself. + */ + public RoutingMessage withAppProperties(Map appProperties) { + this.appProperties = appProperties; + return this; + } + + /** + * Get the systemProperties property: System properties. + * + * @return the systemProperties value. + */ + public Map systemProperties() { + return this.systemProperties; + } + + /** + * Set the systemProperties property: System properties. + * + * @param systemProperties the systemProperties value to set. + * @return the RoutingMessage object itself. + */ + public RoutingMessage withSystemProperties(Map systemProperties) { + this.systemProperties = systemProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingProperties.java new file mode 100644 index 0000000000000..6f3799c460459 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingProperties.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 routing related properties of the IoT hub. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + */ +@Fluent +public final class RoutingProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoutingProperties.class); + + /* + * The properties related to the custom endpoints to which your IoT hub + * routes messages based on the routing rules. A maximum of 10 custom + * endpoints are allowed across all endpoint types for paid hubs and only 1 + * custom endpoint is allowed across all endpoint types for free hubs. + */ + @JsonProperty(value = "endpoints") + private RoutingEndpoints endpoints; + + /* + * The list of user-provided routing rules that the IoT hub uses to route + * messages to built-in and custom endpoints. A maximum of 100 routing + * rules are allowed for paid hubs and a maximum of 5 routing rules are + * allowed for free hubs. + */ + @JsonProperty(value = "routes") + private List routes; + + /* + * The properties of the route that is used as a fall-back route when none + * of the conditions specified in the 'routes' section are met. This is an + * optional parameter. When this property is not set, the messages which do + * not meet any of the conditions specified in the 'routes' section get + * routed to the built-in eventhub endpoint. + */ + @JsonProperty(value = "fallbackRoute") + private FallbackRouteProperties fallbackRoute; + + /* + * The list of user-provided enrichments that the IoT hub applies to + * messages to be delivered to built-in and custom endpoints. See: + * https://aka.ms/telemetryoneventgrid + */ + @JsonProperty(value = "enrichments") + private List enrichments; + + /** + * Get the endpoints property: The properties related to the custom endpoints to which your IoT hub routes messages + * based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs + * and only 1 custom endpoint is allowed across all endpoint types for free hubs. + * + * @return the endpoints value. + */ + public RoutingEndpoints endpoints() { + return this.endpoints; + } + + /** + * Set the endpoints property: The properties related to the custom endpoints to which your IoT hub routes messages + * based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs + * and only 1 custom endpoint is allowed across all endpoint types for free hubs. + * + * @param endpoints the endpoints value to set. + * @return the RoutingProperties object itself. + */ + public RoutingProperties withEndpoints(RoutingEndpoints endpoints) { + this.endpoints = endpoints; + return this; + } + + /** + * Get the routes property: The list of user-provided routing rules that the IoT hub uses to route messages to + * built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 + * routing rules are allowed for free hubs. + * + * @return the routes value. + */ + public List routes() { + return this.routes; + } + + /** + * Set the routes property: The list of user-provided routing rules that the IoT hub uses to route messages to + * built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 + * routing rules are allowed for free hubs. + * + * @param routes the routes value to set. + * @return the RoutingProperties object itself. + */ + public RoutingProperties withRoutes(List routes) { + this.routes = routes; + return this; + } + + /** + * Get the fallbackRoute property: The properties of the route that is used as a fall-back route when none of the + * conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not + * set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the + * built-in eventhub endpoint. + * + * @return the fallbackRoute value. + */ + public FallbackRouteProperties fallbackRoute() { + return this.fallbackRoute; + } + + /** + * Set the fallbackRoute property: The properties of the route that is used as a fall-back route when none of the + * conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not + * set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the + * built-in eventhub endpoint. + * + * @param fallbackRoute the fallbackRoute value to set. + * @return the RoutingProperties object itself. + */ + public RoutingProperties withFallbackRoute(FallbackRouteProperties fallbackRoute) { + this.fallbackRoute = fallbackRoute; + return this; + } + + /** + * Get the enrichments property: The list of user-provided enrichments that the IoT hub applies to messages to be + * delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. + * + * @return the enrichments value. + */ + public List enrichments() { + return this.enrichments; + } + + /** + * Set the enrichments property: The list of user-provided enrichments that the IoT hub applies to messages to be + * delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. + * + * @param enrichments the enrichments value to set. + * @return the RoutingProperties object itself. + */ + public RoutingProperties withEnrichments(List enrichments) { + this.enrichments = enrichments; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (endpoints() != null) { + endpoints().validate(); + } + if (routes() != null) { + routes().forEach(e -> e.validate()); + } + if (fallbackRoute() != null) { + fallbackRoute().validate(); + } + if (enrichments() != null) { + enrichments().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusQueueEndpointProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusQueueEndpointProperties.java new file mode 100644 index 0000000000000..0e53f5ec5b88f --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusQueueEndpointProperties.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 related to service bus queue endpoint types. */ +@Fluent +public final class RoutingServiceBusQueueEndpointProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoutingServiceBusQueueEndpointProperties.class); + + /* + * Id of the service bus queue endpoint + */ + @JsonProperty(value = "id") + private String id; + + /* + * The connection string of the service bus queue endpoint. + */ + @JsonProperty(value = "connectionString") + private String connectionString; + + /* + * The url of the service bus queue endpoint. It must include the protocol + * sb:// + */ + @JsonProperty(value = "endpointUri") + private String endpointUri; + + /* + * Queue name on the service bus namespace + */ + @JsonProperty(value = "entityPath") + private String entityPath; + + /* + * Method used to authenticate against the service bus queue endpoint + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /* + * The name that identifies this endpoint. The name can only include + * alphanumeric characters, periods, underscores, hyphens and has a maximum + * length of 64 characters. The following names are reserved: events, + * fileNotifications, $default. Endpoint names must be unique across + * endpoint types. The name need not be the same as the actual queue name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The subscription identifier of the service bus queue endpoint. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * The name of the resource group of the service bus queue endpoint. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * Get the id property: Id of the service bus queue endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Id of the service bus queue endpoint. + * + * @param id the id value to set. + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Get the connectionString property: The connection string of the service bus queue endpoint. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: The connection string of the service bus queue endpoint. + * + * @param connectionString the connectionString value to set. + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the endpointUri property: The url of the service bus queue endpoint. It must include the protocol sb://. + * + * @return the endpointUri value. + */ + public String endpointUri() { + return this.endpointUri; + } + + /** + * Set the endpointUri property: The url of the service bus queue endpoint. It must include the protocol sb://. + * + * @param endpointUri the endpointUri value to set. + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withEndpointUri(String endpointUri) { + this.endpointUri = endpointUri; + return this; + } + + /** + * Get the entityPath property: Queue name on the service bus namespace. + * + * @return the entityPath value. + */ + public String entityPath() { + return this.entityPath; + } + + /** + * Set the entityPath property: Queue name on the service bus namespace. + * + * @param entityPath the entityPath value to set. + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withEntityPath(String entityPath) { + this.entityPath = entityPath; + return this; + } + + /** + * Get the authenticationType property: Method used to authenticate against the service bus queue endpoint. + * + * @return the authenticationType value. + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Method used to authenticate against the service bus queue endpoint. + * + * @param authenticationType the authenticationType value to set. + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, + * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: + * events, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be + * the same as the actual queue name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, + * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: + * events, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be + * the same as the actual queue name. + * + * @param name the name value to set. + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the subscriptionId property: The subscription identifier of the service bus queue endpoint. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription identifier of the service bus queue endpoint. + * + * @param subscriptionId the subscriptionId value to set. + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup property: The name of the resource group of the service bus queue endpoint. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup property: The name of the resource group of the service bus queue endpoint. + * + * @param resourceGroup the resourceGroup value to set. + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + 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 RoutingServiceBusQueueEndpointProperties")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusTopicEndpointProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusTopicEndpointProperties.java new file mode 100644 index 0000000000000..c3585aedea7dc --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusTopicEndpointProperties.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 related to service bus topic endpoint types. */ +@Fluent +public final class RoutingServiceBusTopicEndpointProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoutingServiceBusTopicEndpointProperties.class); + + /* + * Id of the service bus topic endpoint + */ + @JsonProperty(value = "id") + private String id; + + /* + * The connection string of the service bus topic endpoint. + */ + @JsonProperty(value = "connectionString") + private String connectionString; + + /* + * The url of the service bus topic endpoint. It must include the protocol + * sb:// + */ + @JsonProperty(value = "endpointUri") + private String endpointUri; + + /* + * Queue name on the service bus topic + */ + @JsonProperty(value = "entityPath") + private String entityPath; + + /* + * Method used to authenticate against the service bus topic endpoint + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /* + * The name that identifies this endpoint. The name can only include + * alphanumeric characters, periods, underscores, hyphens and has a maximum + * length of 64 characters. The following names are reserved: events, + * fileNotifications, $default. Endpoint names must be unique across + * endpoint types. The name need not be the same as the actual topic name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The subscription identifier of the service bus topic endpoint. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * The name of the resource group of the service bus topic endpoint. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /** + * Get the id property: Id of the service bus topic endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Id of the service bus topic endpoint. + * + * @param id the id value to set. + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Get the connectionString property: The connection string of the service bus topic endpoint. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: The connection string of the service bus topic endpoint. + * + * @param connectionString the connectionString value to set. + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the endpointUri property: The url of the service bus topic endpoint. It must include the protocol sb://. + * + * @return the endpointUri value. + */ + public String endpointUri() { + return this.endpointUri; + } + + /** + * Set the endpointUri property: The url of the service bus topic endpoint. It must include the protocol sb://. + * + * @param endpointUri the endpointUri value to set. + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withEndpointUri(String endpointUri) { + this.endpointUri = endpointUri; + return this; + } + + /** + * Get the entityPath property: Queue name on the service bus topic. + * + * @return the entityPath value. + */ + public String entityPath() { + return this.entityPath; + } + + /** + * Set the entityPath property: Queue name on the service bus topic. + * + * @param entityPath the entityPath value to set. + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withEntityPath(String entityPath) { + this.entityPath = entityPath; + return this; + } + + /** + * Get the authenticationType property: Method used to authenticate against the service bus topic endpoint. + * + * @return the authenticationType value. + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Method used to authenticate against the service bus topic endpoint. + * + * @param authenticationType the authenticationType value to set. + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, + * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: + * events, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be + * the same as the actual topic name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, + * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: + * events, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be + * the same as the actual topic name. + * + * @param name the name value to set. + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the subscriptionId property: The subscription identifier of the service bus topic endpoint. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription identifier of the service bus topic endpoint. + * + * @param subscriptionId the subscriptionId value to set. + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup property: The name of the resource group of the service bus topic endpoint. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup property: The name of the resource group of the service bus topic endpoint. + * + * @param resourceGroup the resourceGroup value to set. + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + 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 RoutingServiceBusTopicEndpointProperties")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java new file mode 100644 index 0000000000000..092fb58842a26 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RoutingSource. */ +public final class RoutingSource extends ExpandableStringEnum { + /** Static value Invalid for RoutingSource. */ + public static final RoutingSource INVALID = fromString("Invalid"); + + /** Static value DeviceMessages for RoutingSource. */ + public static final RoutingSource DEVICE_MESSAGES = fromString("DeviceMessages"); + + /** Static value TwinChangeEvents for RoutingSource. */ + public static final RoutingSource TWIN_CHANGE_EVENTS = fromString("TwinChangeEvents"); + + /** Static value DeviceLifecycleEvents for RoutingSource. */ + public static final RoutingSource DEVICE_LIFECYCLE_EVENTS = fromString("DeviceLifecycleEvents"); + + /** Static value DeviceJobLifecycleEvents for RoutingSource. */ + public static final RoutingSource DEVICE_JOB_LIFECYCLE_EVENTS = fromString("DeviceJobLifecycleEvents"); + + /** + * Creates or finds a RoutingSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding RoutingSource. + */ + @JsonCreator + public static RoutingSource fromString(String name) { + return fromString(name, RoutingSource.class); + } + + /** @return known RoutingSource values. */ + public static Collection values() { + return values(RoutingSource.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingStorageContainerProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingStorageContainerProperties.java new file mode 100644 index 0000000000000..fe75186ae8366 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingStorageContainerProperties.java @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 related to a storage container endpoint. */ +@Fluent +public final class RoutingStorageContainerProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoutingStorageContainerProperties.class); + + /* + * Id of the storage container endpoint + */ + @JsonProperty(value = "id") + private String id; + + /* + * The connection string of the storage account. + */ + @JsonProperty(value = "connectionString") + private String connectionString; + + /* + * The url of the storage endpoint. It must include the protocol https:// + */ + @JsonProperty(value = "endpointUri") + private String endpointUri; + + /* + * Method used to authenticate against the storage endpoint + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /* + * The name that identifies this endpoint. The name can only include + * alphanumeric characters, periods, underscores, hyphens and has a maximum + * length of 64 characters. The following names are reserved: events, + * fileNotifications, $default. Endpoint names must be unique across + * endpoint types. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The subscription identifier of the storage account. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * The name of the resource group of the storage account. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /* + * The name of storage container in the storage account. + */ + @JsonProperty(value = "containerName", required = true) + private String containerName; + + /* + * File name format for the blob. Default format is + * {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are + * mandatory but can be reordered. + */ + @JsonProperty(value = "fileNameFormat") + private String fileNameFormat; + + /* + * Time interval at which blobs are written to storage. Value should be + * between 60 and 720 seconds. Default value is 300 seconds. + */ + @JsonProperty(value = "batchFrequencyInSeconds") + private Integer batchFrequencyInSeconds; + + /* + * Maximum number of bytes for each blob written to storage. Value should + * be between 10485760(10MB) and 524288000(500MB). Default value is + * 314572800(300MB). + */ + @JsonProperty(value = "maxChunkSizeInBytes") + private Integer maxChunkSizeInBytes; + + /* + * Encoding that is used to serialize messages to blobs. Supported values + * are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. + */ + @JsonProperty(value = "encoding") + private RoutingStorageContainerPropertiesEncoding encoding; + + /** + * Get the id property: Id of the storage container endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Id of the storage container endpoint. + * + * @param id the id value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Get the connectionString property: The connection string of the storage account. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: The connection string of the storage account. + * + * @param connectionString the connectionString value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the endpointUri property: The url of the storage endpoint. It must include the protocol https://. + * + * @return the endpointUri value. + */ + public String endpointUri() { + return this.endpointUri; + } + + /** + * Set the endpointUri property: The url of the storage endpoint. It must include the protocol https://. + * + * @param endpointUri the endpointUri value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withEndpointUri(String endpointUri) { + this.endpointUri = endpointUri; + return this; + } + + /** + * Get the authenticationType property: Method used to authenticate against the storage endpoint. + * + * @return the authenticationType value. + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Method used to authenticate against the storage endpoint. + * + * @param authenticationType the authenticationType value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, + * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: + * events, fileNotifications, $default. Endpoint names must be unique across endpoint types. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, + * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: + * events, fileNotifications, $default. Endpoint names must be unique across endpoint types. + * + * @param name the name value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the subscriptionId property: The subscription identifier of the storage account. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription identifier of the storage account. + * + * @param subscriptionId the subscriptionId value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup property: The name of the resource group of the storage account. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup property: The name of the resource group of the storage account. + * + * @param resourceGroup the resourceGroup value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get the containerName property: The name of storage container in the storage account. + * + * @return the containerName value. + */ + public String containerName() { + return this.containerName; + } + + /** + * Set the containerName property: The name of storage container in the storage account. + * + * @param containerName the containerName value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withContainerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the fileNameFormat property: File name format for the blob. Default format is + * {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be reordered. + * + * @return the fileNameFormat value. + */ + public String fileNameFormat() { + return this.fileNameFormat; + } + + /** + * Set the fileNameFormat property: File name format for the blob. Default format is + * {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be reordered. + * + * @param fileNameFormat the fileNameFormat value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withFileNameFormat(String fileNameFormat) { + this.fileNameFormat = fileNameFormat; + return this; + } + + /** + * Get the batchFrequencyInSeconds property: Time interval at which blobs are written to storage. Value should be + * between 60 and 720 seconds. Default value is 300 seconds. + * + * @return the batchFrequencyInSeconds value. + */ + public Integer batchFrequencyInSeconds() { + return this.batchFrequencyInSeconds; + } + + /** + * Set the batchFrequencyInSeconds property: Time interval at which blobs are written to storage. Value should be + * between 60 and 720 seconds. Default value is 300 seconds. + * + * @param batchFrequencyInSeconds the batchFrequencyInSeconds value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withBatchFrequencyInSeconds(Integer batchFrequencyInSeconds) { + this.batchFrequencyInSeconds = batchFrequencyInSeconds; + return this; + } + + /** + * Get the maxChunkSizeInBytes property: Maximum number of bytes for each blob written to storage. Value should be + * between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). + * + * @return the maxChunkSizeInBytes value. + */ + public Integer maxChunkSizeInBytes() { + return this.maxChunkSizeInBytes; + } + + /** + * Set the maxChunkSizeInBytes property: Maximum number of bytes for each blob written to storage. Value should be + * between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). + * + * @param maxChunkSizeInBytes the maxChunkSizeInBytes value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withMaxChunkSizeInBytes(Integer maxChunkSizeInBytes) { + this.maxChunkSizeInBytes = maxChunkSizeInBytes; + return this; + } + + /** + * Get the encoding property: Encoding that is used to serialize messages to blobs. Supported values are 'avro', + * 'avrodeflate', and 'JSON'. Default value is 'avro'. + * + * @return the encoding value. + */ + public RoutingStorageContainerPropertiesEncoding encoding() { + return this.encoding; + } + + /** + * Set the encoding property: Encoding that is used to serialize messages to blobs. Supported values are 'avro', + * 'avrodeflate', and 'JSON'. Default value is 'avro'. + * + * @param encoding the encoding value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withEncoding(RoutingStorageContainerPropertiesEncoding encoding) { + this.encoding = encoding; + 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 RoutingStorageContainerProperties")); + } + if (containerName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property containerName in model RoutingStorageContainerProperties")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingStorageContainerPropertiesEncoding.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingStorageContainerPropertiesEncoding.java new file mode 100644 index 0000000000000..8948c5e4c85cd --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingStorageContainerPropertiesEncoding.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.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RoutingStorageContainerPropertiesEncoding. */ +public final class RoutingStorageContainerPropertiesEncoding + extends ExpandableStringEnum { + /** Static value Avro for RoutingStorageContainerPropertiesEncoding. */ + public static final RoutingStorageContainerPropertiesEncoding AVRO = fromString("Avro"); + + /** Static value AvroDeflate for RoutingStorageContainerPropertiesEncoding. */ + public static final RoutingStorageContainerPropertiesEncoding AVRO_DEFLATE = fromString("AvroDeflate"); + + /** Static value JSON for RoutingStorageContainerPropertiesEncoding. */ + public static final RoutingStorageContainerPropertiesEncoding JSON = fromString("JSON"); + + /** + * Creates or finds a RoutingStorageContainerPropertiesEncoding from its string representation. + * + * @param name a name to look for. + * @return the corresponding RoutingStorageContainerPropertiesEncoding. + */ + @JsonCreator + public static RoutingStorageContainerPropertiesEncoding fromString(String name) { + return fromString(name, RoutingStorageContainerPropertiesEncoding.class); + } + + /** @return known RoutingStorageContainerPropertiesEncoding values. */ + public static Collection values() { + return values(RoutingStorageContainerPropertiesEncoding.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingTwin.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingTwin.java new file mode 100644 index 0000000000000..3f353d6b29ef9 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingTwin.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** Twin reference input parameter. This is an optional parameter. */ +@Fluent +public final class RoutingTwin { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoutingTwin.class); + + /* + * Twin Tags + */ + @JsonProperty(value = "tags") + private Object tags; + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private RoutingTwinProperties properties; + + /** + * Get the tags property: Twin Tags. + * + * @return the tags value. + */ + public Object tags() { + return this.tags; + } + + /** + * Set the tags property: Twin Tags. + * + * @param tags the tags value to set. + * @return the RoutingTwin object itself. + */ + public RoutingTwin withTags(Object tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public RoutingTwinProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the RoutingTwin object itself. + */ + public RoutingTwin withProperties(RoutingTwinProperties 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingTwinProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingTwinProperties.java new file mode 100644 index 0000000000000..768c19f1f4fc4 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingTwinProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 RoutingTwinProperties model. */ +@Fluent +public final class RoutingTwinProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoutingTwinProperties.class); + + /* + * Twin desired properties + */ + @JsonProperty(value = "desired") + private Object desired; + + /* + * Twin desired properties + */ + @JsonProperty(value = "reported") + private Object reported; + + /** + * Get the desired property: Twin desired properties. + * + * @return the desired value. + */ + public Object desired() { + return this.desired; + } + + /** + * Set the desired property: Twin desired properties. + * + * @param desired the desired value to set. + * @return the RoutingTwinProperties object itself. + */ + public RoutingTwinProperties withDesired(Object desired) { + this.desired = desired; + return this; + } + + /** + * Get the reported property: Twin desired properties. + * + * @return the reported value. + */ + public Object reported() { + return this.reported; + } + + /** + * Set the reported property: Twin desired properties. + * + * @param reported the reported value to set. + * @return the RoutingTwinProperties object itself. + */ + public RoutingTwinProperties withReported(Object reported) { + this.reported = reported; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/SharedAccessSignatureAuthorizationRule.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/SharedAccessSignatureAuthorizationRule.java new file mode 100644 index 0000000000000..7f1ab7f894a35 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/SharedAccessSignatureAuthorizationRule.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.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.SharedAccessSignatureAuthorizationRuleInner; + +/** An immutable client-side representation of SharedAccessSignatureAuthorizationRule. */ +public interface SharedAccessSignatureAuthorizationRule { + /** + * Gets the keyName property: The name of the shared access policy. + * + * @return the keyName value. + */ + String keyName(); + + /** + * Gets the primaryKey property: The primary key. + * + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * Gets the secondaryKey property: The secondary key. + * + * @return the secondaryKey value. + */ + String secondaryKey(); + + /** + * Gets the rights property: The permissions assigned to the shared access policy. + * + * @return the rights value. + */ + AccessRights rights(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.SharedAccessSignatureAuthorizationRuleInner object. + * + * @return the inner object. + */ + SharedAccessSignatureAuthorizationRuleInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/SharedAccessSignatureAuthorizationRuleListResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/SharedAccessSignatureAuthorizationRuleListResult.java new file mode 100644 index 0000000000000..36a3d1d9fe44c --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/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.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of shared access policies with a next link. */ +@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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/StorageEndpointProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/StorageEndpointProperties.java new file mode 100644 index 0000000000000..56b8560b35c58 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/StorageEndpointProperties.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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.time.Duration; + +/** The properties of the Azure Storage endpoint for file upload. */ +@Fluent +public final class StorageEndpointProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageEndpointProperties.class); + + /* + * The period of time for which the SAS URI generated by IoT Hub for file + * upload is valid. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + */ + @JsonProperty(value = "sasTtlAsIso8601") + private Duration sasTtlAsIso8601; + + /* + * The connection string for the Azure Storage account to which files are + * uploaded. + */ + @JsonProperty(value = "connectionString", required = true) + private String connectionString; + + /* + * The name of the root container where you upload files. The container + * need not exist but should be creatable using the connectionString + * specified. + */ + @JsonProperty(value = "containerName", required = true) + private String containerName; + + /* + * Specifies authentication type being used for connecting to the storage + * account. + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /** + * Get the sasTtlAsIso8601 property: The period of time for which the SAS URI generated by IoT Hub for file upload + * is valid. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + * + * @return the sasTtlAsIso8601 value. + */ + public Duration sasTtlAsIso8601() { + return this.sasTtlAsIso8601; + } + + /** + * Set the sasTtlAsIso8601 property: The period of time for which the SAS URI generated by IoT Hub for file upload + * is valid. See: + * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + * + * @param sasTtlAsIso8601 the sasTtlAsIso8601 value to set. + * @return the StorageEndpointProperties object itself. + */ + public StorageEndpointProperties withSasTtlAsIso8601(Duration sasTtlAsIso8601) { + this.sasTtlAsIso8601 = sasTtlAsIso8601; + return this; + } + + /** + * Get the connectionString property: The connection string for the Azure Storage account to which files are + * uploaded. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: The connection string for the Azure Storage account to which files are + * uploaded. + * + * @param connectionString the connectionString value to set. + * @return the StorageEndpointProperties object itself. + */ + public StorageEndpointProperties withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the containerName property: The name of the root container where you upload files. The container need not + * exist but should be creatable using the connectionString specified. + * + * @return the containerName value. + */ + public String containerName() { + return this.containerName; + } + + /** + * Set the containerName property: The name of the root container where you upload files. The container need not + * exist but should be creatable using the connectionString specified. + * + * @param containerName the containerName value to set. + * @return the StorageEndpointProperties object itself. + */ + public StorageEndpointProperties withContainerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the authenticationType property: Specifies authentication type being used for connecting to the storage + * account. + * + * @return the authenticationType value. + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Specifies authentication type being used for connecting to the storage + * account. + * + * @param authenticationType the authenticationType value to set. + * @return the StorageEndpointProperties object itself. + */ + public StorageEndpointProperties withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + 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 StorageEndpointProperties")); + } + if (containerName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property containerName in model StorageEndpointProperties")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TagsResource.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TagsResource.java new file mode 100644 index 0000000000000..4254c12506ffc --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TagsResource.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.iothub.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 an IoT Hub 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/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestAllRoutesInput.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestAllRoutesInput.java new file mode 100644 index 0000000000000..bc114025d07a4 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestAllRoutesInput.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 for testing all routes. */ +@Fluent +public final class TestAllRoutesInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestAllRoutesInput.class); + + /* + * Routing source + */ + @JsonProperty(value = "routingSource") + private RoutingSource routingSource; + + /* + * Routing message + */ + @JsonProperty(value = "message") + private RoutingMessage message; + + /* + * Routing Twin Reference + */ + @JsonProperty(value = "twin") + private RoutingTwin twin; + + /** + * Get the routingSource property: Routing source. + * + * @return the routingSource value. + */ + public RoutingSource routingSource() { + return this.routingSource; + } + + /** + * Set the routingSource property: Routing source. + * + * @param routingSource the routingSource value to set. + * @return the TestAllRoutesInput object itself. + */ + public TestAllRoutesInput withRoutingSource(RoutingSource routingSource) { + this.routingSource = routingSource; + return this; + } + + /** + * Get the message property: Routing message. + * + * @return the message value. + */ + public RoutingMessage message() { + return this.message; + } + + /** + * Set the message property: Routing message. + * + * @param message the message value to set. + * @return the TestAllRoutesInput object itself. + */ + public TestAllRoutesInput withMessage(RoutingMessage message) { + this.message = message; + return this; + } + + /** + * Get the twin property: Routing Twin Reference. + * + * @return the twin value. + */ + public RoutingTwin twin() { + return this.twin; + } + + /** + * Set the twin property: Routing Twin Reference. + * + * @param twin the twin value to set. + * @return the TestAllRoutesInput object itself. + */ + public TestAllRoutesInput withTwin(RoutingTwin twin) { + this.twin = twin; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (message() != null) { + message().validate(); + } + if (twin() != null) { + twin().validate(); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestAllRoutesResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestAllRoutesResult.java new file mode 100644 index 0000000000000..bdca95b496a23 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestAllRoutesResult.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.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.TestAllRoutesResultInner; +import java.util.List; + +/** An immutable client-side representation of TestAllRoutesResult. */ +public interface TestAllRoutesResult { + /** + * Gets the routes property: JSON-serialized array of matched routes. + * + * @return the routes value. + */ + List routes(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.TestAllRoutesResultInner object. + * + * @return the inner object. + */ + TestAllRoutesResultInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestResultStatus.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestResultStatus.java new file mode 100644 index 0000000000000..3637821205b46 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestResultStatus.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.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TestResultStatus. */ +public final class TestResultStatus extends ExpandableStringEnum { + /** Static value undefined for TestResultStatus. */ + public static final TestResultStatus UNDEFINED = fromString("undefined"); + + /** Static value false for TestResultStatus. */ + public static final TestResultStatus FALSE = fromString("false"); + + /** Static value true for TestResultStatus. */ + public static final TestResultStatus TRUE = fromString("true"); + + /** + * Creates or finds a TestResultStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding TestResultStatus. + */ + @JsonCreator + public static TestResultStatus fromString(String name) { + return fromString(name, TestResultStatus.class); + } + + /** @return known TestResultStatus values. */ + public static Collection values() { + return values(TestResultStatus.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestRouteInput.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestRouteInput.java new file mode 100644 index 0000000000000..b9c5e282361cc --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestRouteInput.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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 for testing route. */ +@Fluent +public final class TestRouteInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestRouteInput.class); + + /* + * Routing message + */ + @JsonProperty(value = "message") + private RoutingMessage message; + + /* + * Route properties + */ + @JsonProperty(value = "route", required = true) + private RouteProperties route; + + /* + * Routing Twin Reference + */ + @JsonProperty(value = "twin") + private RoutingTwin twin; + + /** + * Get the message property: Routing message. + * + * @return the message value. + */ + public RoutingMessage message() { + return this.message; + } + + /** + * Set the message property: Routing message. + * + * @param message the message value to set. + * @return the TestRouteInput object itself. + */ + public TestRouteInput withMessage(RoutingMessage message) { + this.message = message; + return this; + } + + /** + * Get the route property: Route properties. + * + * @return the route value. + */ + public RouteProperties route() { + return this.route; + } + + /** + * Set the route property: Route properties. + * + * @param route the route value to set. + * @return the TestRouteInput object itself. + */ + public TestRouteInput withRoute(RouteProperties route) { + this.route = route; + return this; + } + + /** + * Get the twin property: Routing Twin Reference. + * + * @return the twin value. + */ + public RoutingTwin twin() { + return this.twin; + } + + /** + * Set the twin property: Routing Twin Reference. + * + * @param twin the twin value to set. + * @return the TestRouteInput object itself. + */ + public TestRouteInput withTwin(RoutingTwin twin) { + this.twin = twin; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (message() != null) { + message().validate(); + } + if (route() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property route in model TestRouteInput")); + } else { + route().validate(); + } + if (twin() != null) { + twin().validate(); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestRouteResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestRouteResult.java new file mode 100644 index 0000000000000..96805135e81ac --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestRouteResult.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.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.TestRouteResultInner; + +/** An immutable client-side representation of TestRouteResult. */ +public interface TestRouteResult { + /** + * Gets the result property: Result of testing route. + * + * @return the result value. + */ + TestResultStatus result(); + + /** + * Gets the details property: Detailed result of testing route. + * + * @return the details value. + */ + TestRouteResultDetails details(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.TestRouteResultInner object. + * + * @return the inner object. + */ + TestRouteResultInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestRouteResultDetails.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestRouteResultDetails.java new file mode 100644 index 0000000000000..d620c2a4ea786 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/TestRouteResultDetails.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.iothub.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; + +/** Detailed result of testing a route. */ +@Fluent +public final class TestRouteResultDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestRouteResultDetails.class); + + /* + * JSON-serialized list of route compilation errors + */ + @JsonProperty(value = "compilationErrors") + private List compilationErrors; + + /** + * Get the compilationErrors property: JSON-serialized list of route compilation errors. + * + * @return the compilationErrors value. + */ + public List compilationErrors() { + return this.compilationErrors; + } + + /** + * Set the compilationErrors property: JSON-serialized list of route compilation errors. + * + * @param compilationErrors the compilationErrors value to set. + * @return the TestRouteResultDetails object itself. + */ + public TestRouteResultDetails withCompilationErrors(List compilationErrors) { + this.compilationErrors = compilationErrors; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (compilationErrors() != null) { + compilationErrors().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/UserSubscriptionQuota.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/UserSubscriptionQuota.java new file mode 100644 index 0000000000000..5651eef095929 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/UserSubscriptionQuota.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.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; + +/** User subscription quota response. */ +@Fluent +public final class UserSubscriptionQuota { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserSubscriptionQuota.class); + + /* + * IotHub type id + */ + @JsonProperty(value = "id") + private String id; + + /* + * Response type + */ + @JsonProperty(value = "type") + private String type; + + /* + * Unit of IotHub type + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * Current number of IotHub type + */ + @JsonProperty(value = "currentValue") + private Integer currentValue; + + /* + * Numerical limit on IotHub type + */ + @JsonProperty(value = "limit") + private Integer limit; + + /* + * IotHub type + */ + @JsonProperty(value = "name") + private Name name; + + /** + * Get the id property: IotHub type id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: IotHub type id. + * + * @param id the id value to set. + * @return the UserSubscriptionQuota object itself. + */ + public UserSubscriptionQuota withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type property: Response type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Response type. + * + * @param type the type value to set. + * @return the UserSubscriptionQuota object itself. + */ + public UserSubscriptionQuota withType(String type) { + this.type = type; + return this; + } + + /** + * Get the unit property: Unit of IotHub type. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: Unit of IotHub type. + * + * @param unit the unit value to set. + * @return the UserSubscriptionQuota object itself. + */ + public UserSubscriptionQuota withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the currentValue property: Current number of IotHub type. + * + * @return the currentValue value. + */ + public Integer currentValue() { + return this.currentValue; + } + + /** + * Set the currentValue property: Current number of IotHub type. + * + * @param currentValue the currentValue value to set. + * @return the UserSubscriptionQuota object itself. + */ + public UserSubscriptionQuota withCurrentValue(Integer currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the limit property: Numerical limit on IotHub type. + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Set the limit property: Numerical limit on IotHub type. + * + * @param limit the limit value to set. + * @return the UserSubscriptionQuota object itself. + */ + public UserSubscriptionQuota withLimit(Integer limit) { + this.limit = limit; + return this; + } + + /** + * Get the name property: IotHub type. + * + * @return the name value. + */ + public Name name() { + return this.name; + } + + /** + * Set the name property: IotHub type. + * + * @param name the name value to set. + * @return the UserSubscriptionQuota object itself. + */ + public UserSubscriptionQuota withName(Name name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/UserSubscriptionQuotaListResult.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/UserSubscriptionQuotaListResult.java new file mode 100644 index 0000000000000..eb6536af5ba5e --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/UserSubscriptionQuotaListResult.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.iothub.models; + +import com.azure.resourcemanager.iothub.fluent.models.UserSubscriptionQuotaListResultInner; +import java.util.List; + +/** An immutable client-side representation of UserSubscriptionQuotaListResult. */ +public interface UserSubscriptionQuotaListResult { + /** + * Gets the value property: The value property. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.iothub.fluent.models.UserSubscriptionQuotaListResultInner object. + * + * @return the inner object. + */ + UserSubscriptionQuotaListResultInner innerModel(); +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/package-info.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/package-info.java new file mode 100644 index 0000000000000..4f3f404d4a539 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/package-info.java @@ -0,0 +1,8 @@ +// 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 IotHubClient. Use this API to manage the IoT hubs in your Azure subscription. + */ +package com.azure.resourcemanager.iothub.models; diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/package-info.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/package-info.java new file mode 100644 index 0000000000000..ea2c3b72d8d56 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for IotHubClient. Use this API to manage the IoT hubs in your Azure subscription. */ +package com.azure.resourcemanager.iothub; diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/module-info.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/module-info.java new file mode 100644 index 0000000000000..35b88b00abe93 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/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.iothub { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.iothub; + exports com.azure.resourcemanager.iothub.fluent; + exports com.azure.resourcemanager.iothub.fluent.models; + exports com.azure.resourcemanager.iothub.models; + + opens com.azure.resourcemanager.iothub.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.iothub.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/iothub/ci.yml b/sdk/iothub/ci.yml new file mode 100644 index 0000000000000..abf19461a6747 --- /dev/null +++ b/sdk/iothub/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/iothub/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iothub/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: iothub + Artifacts: + - name: azure-resourcemanager-iothub + groupId: com.azure.resourcemanager + safeName: azureresourcemanageriothub diff --git a/sdk/iothub/pom.xml b/sdk/iothub/pom.xml new file mode 100644 index 0000000000000..86828417e9785 --- /dev/null +++ b/sdk/iothub/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-iothub-service + pom + 1.0.0 + + azure-resourcemanager-iothub + +