diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index d932349db1d89..301c5c8bd5aa7 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -186,6 +186,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-iotcentral;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..6371cc3241447 100644 --- a/pom.xml +++ b/pom.xml @@ -27,6 +27,7 @@ sdk/formrecognizer sdk/hdinsight sdk/identity + sdk/iotcentral sdk/keyvault sdk/kusto sdk/loganalytics diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/CHANGELOG.md b/sdk/iotcentral/azure-resourcemanager-iotcentral/CHANGELOG.md new file mode 100644 index 0000000000000..270433c5e2810 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-24) + +- Azure Resource Manager IotCentral client library for Java. This package contains Microsoft Azure SDK for IotCentral Management SDK. Use this API to manage IoT Central Applications in your Azure subscription. Package tag package-2018-09-01. 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/iotcentral/azure-resourcemanager-iotcentral/README.md b/sdk/iotcentral/azure-resourcemanager-iotcentral/README.md new file mode 100644 index 0000000000000..bd052baf8b476 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/README.md @@ -0,0 +1,83 @@ +# Azure Resource Manager IotCentral client library for Java + +Azure Resource Manager IotCentral client library for Java. + +This package contains Microsoft Azure SDK for IotCentral Management SDK. Use this API to manage IoT Central Applications in your Azure subscription. Package tag package-2018-09-01. 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-iotcentral;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-iotcentral + 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(); +IotCentralManager manager = IotCentralManager + .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/iotcentral/azure-resourcemanager-iotcentral/pom.xml b/sdk/iotcentral/azure-resourcemanager-iotcentral/pom.xml new file mode 100644 index 0000000000000..46f41aaf2426d --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/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-iotcentral + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for IotCentral Management + This package contains Microsoft Azure SDK for IotCentral Management SDK. Use this API to manage IoT Central Applications in your Azure subscription. Package tag package-2018-09-01. 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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/IotCentralManager.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/IotCentralManager.java new file mode 100644 index 0000000000000..8d00f5d0928d5 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/IotCentralManager.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral; + +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.iotcentral.fluent.IotCentralClient; +import com.azure.resourcemanager.iotcentral.implementation.AppsImpl; +import com.azure.resourcemanager.iotcentral.implementation.IotCentralClientBuilder; +import com.azure.resourcemanager.iotcentral.implementation.OperationsImpl; +import com.azure.resourcemanager.iotcentral.models.Apps; +import com.azure.resourcemanager.iotcentral.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to IotCentralManager. Use this API to manage IoT Central Applications in your Azure subscription. */ +public final class IotCentralManager { + private Apps apps; + + private Operations operations; + + private final IotCentralClient clientObject; + + private IotCentralManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new IotCentralClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of IotCentral service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the IotCentral service API instance. + */ + public static IotCentralManager 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 IotCentralManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new IotCentralManager.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 IotCentral service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the IotCentral service API instance. + */ + public IotCentralManager 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.iotcentral", + "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 IotCentralManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Apps. */ + public Apps apps() { + if (this.apps == null) { + this.apps = new AppsImpl(clientObject.getApps(), this); + } + return apps; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client IotCentralClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public IotCentralClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/AppsClient.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/AppsClient.java new file mode 100644 index 0000000000000..b4988bc2825a4 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/AppsClient.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.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.iotcentral.fluent.models.AppAvailabilityInfoInner; +import com.azure.resourcemanager.iotcentral.fluent.models.AppInner; +import com.azure.resourcemanager.iotcentral.fluent.models.AppTemplateInner; +import com.azure.resourcemanager.iotcentral.models.AppPatch; +import com.azure.resourcemanager.iotcentral.models.OperationInputs; + +/** An instance of this class provides access to all the operations defined in AppsClient. */ +public interface AppsClient { + /** + * Get the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AppInner getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Get the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String resourceName, Context context); + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AppInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, AppInner app); + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AppInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, AppInner app, Context context); + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AppInner createOrUpdate(String resourceGroupName, String resourceName, AppInner app); + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AppInner createOrUpdate(String resourceGroupName, String resourceName, AppInner app, Context context); + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AppInner> beginUpdate( + String resourceGroupName, String resourceName, AppPatch appPatch); + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AppInner> beginUpdate( + String resourceGroupName, String resourceName, AppPatch appPatch, Context context); + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AppInner update(String resourceGroupName, String resourceName, AppPatch appPatch); + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AppInner update(String resourceGroupName, String resourceName, AppPatch appPatch, Context context); + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName); + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName, Context context); + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceName); + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceName, Context context); + + /** + * Get all IoT Central Applications in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all IoT Central Applications in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get all IoT Central Applications in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all IoT Central Applications in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get all the IoT Central Applications in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the IoT Central Applications in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get all the IoT Central Applications in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the IoT Central Applications in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Check if an IoT Central application name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central + * application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AppAvailabilityInfoInner checkNameAvailability(OperationInputs operationInputs); + + /** + * Check if an IoT Central application name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central + * application to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + OperationInputs operationInputs, Context context); + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT + * Central application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AppAvailabilityInfoInner checkSubdomainAvailability(OperationInputs operationInputs); + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT + * Central application to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkSubdomainAvailabilityWithResponse( + OperationInputs operationInputs, Context context); + + /** + * Get all available application templates. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available application templates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listTemplates(); + + /** + * Get all available application templates. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available application templates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listTemplates(Context context); +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/IotCentralClient.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/IotCentralClient.java new file mode 100644 index 0000000000000..0322c1a334f15 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/IotCentralClient.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.iotcentral.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for IotCentralClient class. */ +public interface IotCentralClient { + /** + * 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 AppsClient object to access its operations. + * + * @return the AppsClient object. + */ + AppsClient getApps(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/OperationsClient.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/OperationsClient.java new file mode 100644 index 0000000000000..e9f812521472d --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.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.iotcentral.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 Central application REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available IoT Central application REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppAvailabilityInfoInner.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppAvailabilityInfoInner.java new file mode 100644 index 0000000000000..75942e55dd4a8 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppAvailabilityInfoInner.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.iotcentral.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; + +/** The properties indicating whether a given IoT Central application name or subdomain is available. */ +@Immutable +public final class AppAvailabilityInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppAvailabilityInfoInner.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 String reason; + + /* + * The detailed reason message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + 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 String reason() { + return this.reason; + } + + /** + * Get the message property: The detailed reason message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppInner.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppInner.java new file mode 100644 index 0000000000000..2955e20bd3b33 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppInner.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iotcentral.models.AppSkuInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The IoT Central application. */ +@JsonFlatten +@Fluent +public class AppInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppInner.class); + + /* + * A valid instance SKU. + */ + @JsonProperty(value = "sku", required = true) + private AppSkuInfo sku; + + /* + * The ID of the application. + */ + @JsonProperty(value = "properties.applicationId", access = JsonProperty.Access.WRITE_ONLY) + private String applicationId; + + /* + * The display name of the application. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * The subdomain of the application. + */ + @JsonProperty(value = "properties.subdomain") + private String subdomain; + + /* + * The ID of the application template, which is a blueprint that defines + * the characteristics and behaviors of an application. Optional; if not + * specified, defaults to a blank blueprint and allows the application to + * be defined from scratch. + */ + @JsonProperty(value = "properties.template") + private String template; + + /** + * Get the sku property: A valid instance SKU. + * + * @return the sku value. + */ + public AppSkuInfo sku() { + return this.sku; + } + + /** + * Set the sku property: A valid instance SKU. + * + * @param sku the sku value to set. + * @return the AppInner object itself. + */ + public AppInner withSku(AppSkuInfo sku) { + this.sku = sku; + return this; + } + + /** + * Get the applicationId property: The ID of the application. + * + * @return the applicationId value. + */ + public String applicationId() { + return this.applicationId; + } + + /** + * Get the displayName property: The display name of the application. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the application. + * + * @param displayName the displayName value to set. + * @return the AppInner object itself. + */ + public AppInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the subdomain property: The subdomain of the application. + * + * @return the subdomain value. + */ + public String subdomain() { + return this.subdomain; + } + + /** + * Set the subdomain property: The subdomain of the application. + * + * @param subdomain the subdomain value to set. + * @return the AppInner object itself. + */ + public AppInner withSubdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + /** + * Get the template property: The ID of the application template, which is a blueprint that defines the + * characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and + * allows the application to be defined from scratch. + * + * @return the template value. + */ + public String template() { + return this.template; + } + + /** + * Set the template property: The ID of the application template, which is a blueprint that defines the + * characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and + * allows the application to be defined from scratch. + * + * @param template the template value to set. + * @return the AppInner object itself. + */ + public AppInner withTemplate(String template) { + this.template = template; + return this; + } + + /** {@inheritDoc} */ + @Override + public AppInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AppInner withTags(Map tags) { + super.withTags(tags); + 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 AppInner")); + } else { + sku().validate(); + } + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppTemplateInner.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppTemplateInner.java new file mode 100644 index 0000000000000..47dbfaaf8b613 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppTemplateInner.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.iotcentral.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; + +/** IoT Central Application Template. */ +@Immutable +public final class AppTemplateInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppTemplateInner.class); + + /* + * The ID of the template. + */ + @JsonProperty(value = "manifestId", access = JsonProperty.Access.WRITE_ONLY) + private String manifestId; + + /* + * The version of the template. + */ + @JsonProperty(value = "manifestVersion", access = JsonProperty.Access.WRITE_ONLY) + private String manifestVersion; + + /* + * The name of the template. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The title of the template. + */ + @JsonProperty(value = "title", access = JsonProperty.Access.WRITE_ONLY) + private String title; + + /* + * The order of the template in the templates list. + */ + @JsonProperty(value = "order", access = JsonProperty.Access.WRITE_ONLY) + private Float order; + + /* + * The description of the template. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the manifestId property: The ID of the template. + * + * @return the manifestId value. + */ + public String manifestId() { + return this.manifestId; + } + + /** + * Get the manifestVersion property: The version of the template. + * + * @return the manifestVersion value. + */ + public String manifestVersion() { + return this.manifestVersion; + } + + /** + * Get the name property: The name of the template. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the title property: The title of the template. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the order property: The order of the template in the templates list. + * + * @return the order value. + */ + public Float order() { + return this.order; + } + + /** + * Get the description property: The description of the template. + * + * @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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/OperationInner.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..5f429387d33a3 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/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.iotcentral.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iotcentral.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** IoT Central 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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/package-info.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/package-info.java new file mode 100644 index 0000000000000..631901b0670fd --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/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 IotCentralClient. Use this API to manage IoT Central Applications in + * your Azure subscription. + */ +package com.azure.resourcemanager.iotcentral.fluent.models; diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/package-info.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/package-info.java new file mode 100644 index 0000000000000..8699e4927b091 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/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 IotCentralClient. Use this API to manage IoT Central Applications in your + * Azure subscription. + */ +package com.azure.resourcemanager.iotcentral.fluent; diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppAvailabilityInfoImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppAvailabilityInfoImpl.java new file mode 100644 index 0000000000000..a631b55feaa9f --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppAvailabilityInfoImpl.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.iotcentral.implementation; + +import com.azure.resourcemanager.iotcentral.IotCentralManager; +import com.azure.resourcemanager.iotcentral.fluent.models.AppAvailabilityInfoInner; +import com.azure.resourcemanager.iotcentral.models.AppAvailabilityInfo; + +public final class AppAvailabilityInfoImpl implements AppAvailabilityInfo { + private AppAvailabilityInfoInner innerObject; + + private final IotCentralManager serviceManager; + + AppAvailabilityInfoImpl(AppAvailabilityInfoInner innerObject, IotCentralManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public AppAvailabilityInfoInner innerModel() { + return this.innerObject; + } + + private IotCentralManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppImpl.java new file mode 100644 index 0000000000000..41c2064d765a1 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppImpl.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.iotcentral.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.iotcentral.IotCentralManager; +import com.azure.resourcemanager.iotcentral.fluent.models.AppInner; +import com.azure.resourcemanager.iotcentral.models.App; +import com.azure.resourcemanager.iotcentral.models.AppPatch; +import com.azure.resourcemanager.iotcentral.models.AppSkuInfo; +import java.util.Collections; +import java.util.Map; + +public final class AppImpl implements App, App.Definition, App.Update { + private AppInner innerObject; + + private final IotCentralManager 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 AppSkuInfo sku() { + return this.innerModel().sku(); + } + + public String applicationId() { + return this.innerModel().applicationId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String subdomain() { + return this.innerModel().subdomain(); + } + + public String template() { + return this.innerModel().template(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public AppInner innerModel() { + return this.innerObject; + } + + private IotCentralManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private AppPatch updateAppPatch; + + public AppImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public App create() { + this.innerObject = + serviceManager + .serviceClient() + .getApps() + .createOrUpdate(resourceGroupName, resourceName, this.innerModel(), Context.NONE); + return this; + } + + public App create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApps() + .createOrUpdate(resourceGroupName, resourceName, this.innerModel(), context); + return this; + } + + AppImpl(String name, IotCentralManager serviceManager) { + this.innerObject = new AppInner(); + this.serviceManager = serviceManager; + this.resourceName = name; + } + + public AppImpl update() { + this.updateAppPatch = new AppPatch(); + return this; + } + + public App apply() { + this.innerObject = + serviceManager + .serviceClient() + .getApps() + .update(resourceGroupName, resourceName, updateAppPatch, Context.NONE); + return this; + } + + public App apply(Context context) { + this.innerObject = + serviceManager.serviceClient().getApps().update(resourceGroupName, resourceName, updateAppPatch, context); + return this; + } + + AppImpl(AppInner innerObject, IotCentralManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "IoTApps"); + } + + public App refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getApps() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE) + .getValue(); + return this; + } + + public App refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApps() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, context) + .getValue(); + return this; + } + + public AppImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AppImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AppImpl withSku(AppSkuInfo sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateAppPatch.withSku(sku); + return this; + } + } + + public AppImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateAppPatch.withTags(tags); + return this; + } + } + + public AppImpl withDisplayName(String displayName) { + if (isInCreateMode()) { + this.innerModel().withDisplayName(displayName); + return this; + } else { + this.updateAppPatch.withDisplayName(displayName); + return this; + } + } + + public AppImpl withSubdomain(String subdomain) { + if (isInCreateMode()) { + this.innerModel().withSubdomain(subdomain); + return this; + } else { + this.updateAppPatch.withSubdomain(subdomain); + return this; + } + } + + public AppImpl withTemplate(String template) { + if (isInCreateMode()) { + this.innerModel().withTemplate(template); + return this; + } else { + this.updateAppPatch.withTemplate(template); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppTemplateImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppTemplateImpl.java new file mode 100644 index 0000000000000..dc259f734fa4b --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppTemplateImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.implementation; + +import com.azure.resourcemanager.iotcentral.IotCentralManager; +import com.azure.resourcemanager.iotcentral.fluent.models.AppTemplateInner; +import com.azure.resourcemanager.iotcentral.models.AppTemplate; + +public final class AppTemplateImpl implements AppTemplate { + private AppTemplateInner innerObject; + + private final IotCentralManager serviceManager; + + AppTemplateImpl(AppTemplateInner innerObject, IotCentralManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String manifestId() { + return this.innerModel().manifestId(); + } + + public String manifestVersion() { + return this.innerModel().manifestVersion(); + } + + public String name() { + return this.innerModel().name(); + } + + public String title() { + return this.innerModel().title(); + } + + public Float order() { + return this.innerModel().order(); + } + + public String description() { + return this.innerModel().description(); + } + + public AppTemplateInner innerModel() { + return this.innerObject; + } + + private IotCentralManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsClientImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsClientImpl.java new file mode 100644 index 0000000000000..0110e0f1443c9 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsClientImpl.java @@ -0,0 +1,2091 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.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.iotcentral.fluent.AppsClient; +import com.azure.resourcemanager.iotcentral.fluent.models.AppAvailabilityInfoInner; +import com.azure.resourcemanager.iotcentral.fluent.models.AppInner; +import com.azure.resourcemanager.iotcentral.fluent.models.AppTemplateInner; +import com.azure.resourcemanager.iotcentral.models.AppListResult; +import com.azure.resourcemanager.iotcentral.models.AppPatch; +import com.azure.resourcemanager.iotcentral.models.AppTemplatesResult; +import com.azure.resourcemanager.iotcentral.models.OperationInputs; +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 AppsClient. */ +public final class AppsClientImpl implements AppsClient { + private final ClientLogger logger = new ClientLogger(AppsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AppsService service; + + /** The service client containing this operation class. */ + private final IotCentralClientImpl client; + + /** + * Initializes an instance of AppsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AppsClientImpl(IotCentralClientImpl client) { + this.service = RestProxy.create(AppsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotCentralClientApps to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotCentralClientApps") + private interface AppsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps" + + "/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.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.IoTCentral/IoTApps" + + "/{resourceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") AppInner app, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps" + + "/{resourceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") AppPatch appPatch, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps" + + "/{resourceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.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.IoTCentral/IoTApps") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.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"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.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}/providers/Microsoft.IoTCentral/checkSubdomainAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkSubdomainAvailability( + @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}/providers/Microsoft.IoTCentral/appTemplates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listTemplates( + @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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listTemplatesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + @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 metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + @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 metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + @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 metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupAsync(resourceGroupName, resourceName).block(); + } + + /** + * Get the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + @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 Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, AppInner app) { + 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 (app == null) { + return Mono.error(new IllegalArgumentException("Parameter app is required and cannot be null.")); + } else { + app.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + app, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, AppInner app, 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 (app == null) { + return Mono.error(new IllegalArgumentException("Parameter app is required and cannot be null.")); + } else { + app.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, + app, + accept, + context); + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AppInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, AppInner app) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, resourceName, app); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AppInner.class, AppInner.class, Context.NONE); + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AppInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, AppInner app, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, app, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AppInner.class, AppInner.class, context); + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AppInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, AppInner app) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, app).getSyncPoller(); + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AppInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, AppInner app, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, app, context).getSyncPoller(); + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String resourceName, AppInner app) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, app) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, AppInner app, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, app, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppInner createOrUpdate(String resourceGroupName, String resourceName, AppInner app) { + return createOrUpdateAsync(resourceGroupName, resourceName, app).block(); + } + + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to + * retrieve the IoT Central application metadata and security metadata, and then combine them with the modified + * values in a new body to update the IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppInner createOrUpdate(String resourceGroupName, String resourceName, AppInner app, Context context) { + return createOrUpdateAsync(resourceGroupName, resourceName, app, context).block(); + } + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String resourceName, AppPatch appPatch) { + 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 (appPatch == null) { + return Mono.error(new IllegalArgumentException("Parameter appPatch is required and cannot be null.")); + } else { + appPatch.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + appPatch, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String resourceName, AppPatch appPatch, 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 (appPatch == null) { + return Mono.error(new IllegalArgumentException("Parameter appPatch is required and cannot be null.")); + } else { + appPatch.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, + appPatch, + accept, + context); + } + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AppInner> beginUpdateAsync( + String resourceGroupName, String resourceName, AppPatch appPatch) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, resourceName, appPatch); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AppInner.class, AppInner.class, Context.NONE); + } + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AppInner> beginUpdateAsync( + String resourceGroupName, String resourceName, AppPatch appPatch, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, resourceName, appPatch, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AppInner.class, AppInner.class, context); + } + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AppInner> beginUpdate( + String resourceGroupName, String resourceName, AppPatch appPatch) { + return beginUpdateAsync(resourceGroupName, resourceName, appPatch).getSyncPoller(); + } + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AppInner> beginUpdate( + String resourceGroupName, String resourceName, AppPatch appPatch, Context context) { + return beginUpdateAsync(resourceGroupName, resourceName, appPatch, context).getSyncPoller(); + } + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String resourceName, AppPatch appPatch) { + return beginUpdateAsync(resourceGroupName, resourceName, appPatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, AppPatch appPatch, Context context) { + return beginUpdateAsync(resourceGroupName, resourceName, appPatch, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppInner update(String resourceGroupName, String resourceName, AppPatch appPatch) { + return updateAsync(resourceGroupName, resourceName, appPatch).block(); + } + + /** + * Update the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the IoT Central application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppInner update(String resourceGroupName, String resourceName, AppPatch appPatch, Context context) { + return updateAsync(resourceGroupName, resourceName, appPatch, context).block(); + } + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + 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 Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, 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 Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String resourceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String resourceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceName).getSyncPoller(); + } + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context).getSyncPoller(); + } + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + return beginDeleteAsync(resourceGroupName, resourceName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName) { + deleteAsync(resourceGroupName, resourceName).block(); + } + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName, Context context) { + deleteAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Get all IoT Central Applications in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all IoT Central Applications 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 IoT Central Applications in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all IoT Central Applications 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 IoT Central Applications in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all IoT Central Applications in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Get all IoT Central Applications in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all IoT Central Applications in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all IoT Central Applications in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all IoT Central Applications in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get all IoT Central Applications in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all IoT Central Applications in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get all the IoT Central Applications in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the IoT Central Applications 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 Central Applications in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the IoT Central Applications 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 Central Applications in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the IoT Central Applications 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 Central Applications in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the IoT Central Applications 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 Central Applications in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the IoT Central Applications in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get all the IoT Central Applications in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the IoT Central Applications in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Check if an IoT Central application name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central + * application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Central application name or subdomain 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 Central application name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central + * application to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Central application name or subdomain 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 Central application name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central + * application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Central application name or subdomain 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 Central application name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central + * application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppAvailabilityInfoInner checkNameAvailability(OperationInputs operationInputs) { + return checkNameAvailabilityAsync(operationInputs).block(); + } + + /** + * Check if an IoT Central application name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central + * application to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + OperationInputs operationInputs, Context context) { + return checkNameAvailabilityWithResponseAsync(operationInputs, context).block(); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT + * Central application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkSubdomainAvailabilityWithResponseAsync( + 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 + .checkSubdomainAvailability( + 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 Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT + * Central application to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkSubdomainAvailabilityWithResponseAsync( + 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 + .checkSubdomainAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + operationInputs, + accept, + context); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT + * Central application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkSubdomainAvailabilityAsync(OperationInputs operationInputs) { + return checkSubdomainAvailabilityWithResponseAsync(operationInputs) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT + * Central application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppAvailabilityInfoInner checkSubdomainAvailability(OperationInputs operationInputs) { + return checkSubdomainAvailabilityAsync(operationInputs).block(); + } + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT + * Central application to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Central application name or subdomain is available. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkSubdomainAvailabilityWithResponse( + OperationInputs operationInputs, Context context) { + return checkSubdomainAvailabilityWithResponseAsync(operationInputs, context).block(); + } + + /** + * Get all available application templates. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available application templates. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTemplatesSinglePageAsync() { + 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 + .listTemplates( + 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 available application templates. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available application templates. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTemplatesSinglePageAsync(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 + .listTemplates( + 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 available application templates. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available application templates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listTemplatesAsync() { + return new PagedFlux<>( + () -> listTemplatesSinglePageAsync(), nextLink -> listTemplatesNextSinglePageAsync(nextLink)); + } + + /** + * Get all available application templates. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available application templates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listTemplatesAsync(Context context) { + return new PagedFlux<>( + () -> listTemplatesSinglePageAsync(context), + nextLink -> listTemplatesNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all available application templates. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available application templates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTemplates() { + return new PagedIterable<>(listTemplatesAsync()); + } + + /** + * Get all available application templates. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available application templates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTemplates(Context context) { + return new PagedIterable<>(listTemplatesAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central Applications 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central Applications 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central Applications 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central Applications 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central Application Templates with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTemplatesNextSinglePageAsync(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.listTemplatesNext(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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central Application Templates with a next link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTemplatesNextSinglePageAsync(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 + .listTemplatesNext(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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsImpl.java new file mode 100644 index 0000000000000..0e95f5b22af76 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsImpl.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.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.iotcentral.IotCentralManager; +import com.azure.resourcemanager.iotcentral.fluent.AppsClient; +import com.azure.resourcemanager.iotcentral.fluent.models.AppAvailabilityInfoInner; +import com.azure.resourcemanager.iotcentral.fluent.models.AppInner; +import com.azure.resourcemanager.iotcentral.fluent.models.AppTemplateInner; +import com.azure.resourcemanager.iotcentral.models.App; +import com.azure.resourcemanager.iotcentral.models.AppAvailabilityInfo; +import com.azure.resourcemanager.iotcentral.models.AppTemplate; +import com.azure.resourcemanager.iotcentral.models.Apps; +import com.azure.resourcemanager.iotcentral.models.OperationInputs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AppsImpl implements Apps { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppsImpl.class); + + private final AppsClient innerClient; + + private final IotCentralManager serviceManager; + + public AppsImpl(AppsClient innerClient, IotCentralManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public App getByResourceGroup(String resourceGroupName, String resourceName) { + AppInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName); + if (inner != null) { + return new AppImpl(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 AppImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String resourceName) { + this.serviceClient().delete(resourceGroupName, resourceName); + } + + public void delete(String resourceGroupName, String resourceName, Context context) { + this.serviceClient().delete(resourceGroupName, resourceName, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new AppImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new AppImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new AppImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new AppImpl(inner1, this.manager())); + } + + public AppAvailabilityInfo checkNameAvailability(OperationInputs operationInputs) { + AppAvailabilityInfoInner inner = this.serviceClient().checkNameAvailability(operationInputs); + if (inner != null) { + return new AppAvailabilityInfoImpl(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 AppAvailabilityInfoImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AppAvailabilityInfo checkSubdomainAvailability(OperationInputs operationInputs) { + AppAvailabilityInfoInner inner = this.serviceClient().checkSubdomainAvailability(operationInputs); + if (inner != null) { + return new AppAvailabilityInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkSubdomainAvailabilityWithResponse( + OperationInputs operationInputs, Context context) { + Response inner = + this.serviceClient().checkSubdomainAvailabilityWithResponse(operationInputs, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AppAvailabilityInfoImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listTemplates() { + PagedIterable inner = this.serviceClient().listTemplates(); + return inner.mapPage(inner1 -> new AppTemplateImpl(inner1, this.manager())); + } + + public PagedIterable listTemplates(Context context) { + PagedIterable inner = this.serviceClient().listTemplates(context); + return inner.mapPage(inner1 -> new AppTemplateImpl(inner1, this.manager())); + } + + public App 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, "IoTApps"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IoTApps'.", 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, "IoTApps"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IoTApps'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, 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, "IoTApps"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IoTApps'.", id))); + } + this.delete(resourceGroupName, resourceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "IoTApps"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IoTApps'.", id))); + } + this.delete(resourceGroupName, resourceName, context); + } + + private AppsClient serviceClient() { + return this.innerClient; + } + + private IotCentralManager manager() { + return this.serviceManager; + } + + public AppImpl define(String name) { + return new AppImpl(name, this.manager()); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/IotCentralClientBuilder.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/IotCentralClientBuilder.java new file mode 100644 index 0000000000000..e610f995f83ae --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/IotCentralClientBuilder.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.iotcentral.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 IotCentralClientImpl type. */ +@ServiceClientBuilder(serviceClients = {IotCentralClientImpl.class}) +public final class IotCentralClientBuilder { + /* + * The subscription identifier. + */ + private String subscriptionId; + + /** + * Sets The subscription identifier. + * + * @param subscriptionId the subscriptionId value. + * @return the IotCentralClientBuilder. + */ + public IotCentralClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the IotCentralClientBuilder. + */ + public IotCentralClientBuilder 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 IotCentralClientBuilder. + */ + public IotCentralClientBuilder 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 IotCentralClientBuilder. + */ + public IotCentralClientBuilder 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 IotCentralClientBuilder. + */ + public IotCentralClientBuilder 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 IotCentralClientBuilder. + */ + public IotCentralClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of IotCentralClientImpl with the provided parameters. + * + * @return an instance of IotCentralClientImpl. + */ + public IotCentralClientImpl 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(); + } + IotCentralClientImpl client = + new IotCentralClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/IotCentralClientImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/IotCentralClientImpl.java new file mode 100644 index 0000000000000..479e0feeedc5b --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/IotCentralClientImpl.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.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.iotcentral.fluent.AppsClient; +import com.azure.resourcemanager.iotcentral.fluent.IotCentralClient; +import com.azure.resourcemanager.iotcentral.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the IotCentralClientImpl type. */ +@ServiceClient(builder = IotCentralClientBuilder.class) +public final class IotCentralClientImpl implements IotCentralClient { + private final ClientLogger logger = new ClientLogger(IotCentralClientImpl.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 AppsClient object to access its operations. */ + private final AppsClient apps; + + /** + * Gets the AppsClient object to access its operations. + * + * @return the AppsClient object. + */ + public AppsClient getApps() { + return this.apps; + } + + /** 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; + } + + /** + * Initializes an instance of IotCentralClient 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. + */ + IotCentralClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2018-09-01"; + this.apps = new AppsClientImpl(this); + this.operations = new OperationsClientImpl(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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/OperationImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/OperationImpl.java new file mode 100644 index 0000000000000..afb4e97df9da6 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/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.iotcentral.implementation; + +import com.azure.resourcemanager.iotcentral.IotCentralManager; +import com.azure.resourcemanager.iotcentral.fluent.models.OperationInner; +import com.azure.resourcemanager.iotcentral.models.Operation; +import com.azure.resourcemanager.iotcentral.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final IotCentralManager serviceManager; + + OperationImpl(OperationInner innerObject, IotCentralManager 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 IotCentralManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/OperationsClientImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..77f61551f9b0a --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/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.iotcentral.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iotcentral.fluent.OperationsClient; +import com.azure.resourcemanager.iotcentral.fluent.models.OperationInner; +import com.azure.resourcemanager.iotcentral.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 IotCentralClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(IotCentralClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotCentralClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotCentralClientOper") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.IoTCentral/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available IoT Central application REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central 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 Central application REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central 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 Central application REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available IoT Central application REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central 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 Central application REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available IoT Central application REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central 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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/OperationsImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..a5d382b339526 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/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.iotcentral.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.iotcentral.IotCentralManager; +import com.azure.resourcemanager.iotcentral.fluent.OperationsClient; +import com.azure.resourcemanager.iotcentral.fluent.models.OperationInner; +import com.azure.resourcemanager.iotcentral.models.Operation; +import com.azure.resourcemanager.iotcentral.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 IotCentralManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, IotCentralManager 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 IotCentralManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/Utils.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/Utils.java new file mode 100644 index 0000000000000..5b208b3ec098f --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/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.iotcentral.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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/package-info.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/package-info.java new file mode 100644 index 0000000000000..2b3ef171755a5 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/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 IotCentralClient. Use this API to manage IoT Central Applications in your + * Azure subscription. + */ +package com.azure.resourcemanager.iotcentral.implementation; diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/App.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/App.java new file mode 100644 index 0000000000000..b76936f50df1e --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/App.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.iotcentral.fluent.models.AppInner; +import java.util.Map; + +/** An immutable client-side representation of App. */ +public interface App { + /** + * 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 sku property: A valid instance SKU. + * + * @return the sku value. + */ + AppSkuInfo sku(); + + /** + * Gets the applicationId property: The ID of the application. + * + * @return the applicationId value. + */ + String applicationId(); + + /** + * Gets the displayName property: The display name of the application. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the subdomain property: The subdomain of the application. + * + * @return the subdomain value. + */ + String subdomain(); + + /** + * Gets the template property: The ID of the application template, which is a blueprint that defines the + * characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and + * allows the application to be defined from scratch. + * + * @return the template value. + */ + String template(); + + /** + * 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.iotcentral.fluent.models.AppInner object. + * + * @return the inner object. + */ + AppInner innerModel(); + + /** The entirety of the App definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithSku, + DefinitionStages.WithCreate { + } + /** The App definition stages. */ + interface DefinitionStages { + /** The first stage of the App definition. */ + interface Blank extends WithLocation { + } + /** The stage of the App 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 App definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @return the next definition stage. + */ + WithSku withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the App definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: A valid instance SKU.. + * + * @param sku A valid instance SKU. + * @return the next definition stage. + */ + WithCreate withSku(AppSkuInfo sku); + } + /** + * The stage of the App 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.WithDisplayName, + DefinitionStages.WithSubdomain, + DefinitionStages.WithTemplate { + /** + * Executes the create request. + * + * @return the created resource. + */ + App create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + App create(Context context); + } + /** The stage of the App 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 App definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the application.. + * + * @param displayName The display name of the application. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + /** The stage of the App definition allowing to specify subdomain. */ + interface WithSubdomain { + /** + * Specifies the subdomain property: The subdomain of the application.. + * + * @param subdomain The subdomain of the application. + * @return the next definition stage. + */ + WithCreate withSubdomain(String subdomain); + } + /** The stage of the App definition allowing to specify template. */ + interface WithTemplate { + /** + * Specifies the template property: The ID of the application template, which is a blueprint that defines + * the characteristics and behaviors of an application. Optional; if not specified, defaults to a blank + * blueprint and allows the application to be defined from scratch.. + * + * @param template The ID of the application template, which is a blueprint that defines the characteristics + * and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and allows + * the application to be defined from scratch. + * @return the next definition stage. + */ + WithCreate withTemplate(String template); + } + } + /** + * Begins update for the App resource. + * + * @return the stage of resource update. + */ + App.Update update(); + + /** The template for App update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithDisplayName, + UpdateStages.WithSubdomain, + UpdateStages.WithTemplate { + /** + * Executes the update request. + * + * @return the updated resource. + */ + App apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + App apply(Context context); + } + /** The App update stages. */ + interface UpdateStages { + /** The stage of the App update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Instance tags. + * + * @param tags Instance tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the App update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: A valid instance SKU.. + * + * @param sku A valid instance SKU. + * @return the next definition stage. + */ + Update withSku(AppSkuInfo sku); + } + /** The stage of the App update allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the application.. + * + * @param displayName The display name of the application. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + /** The stage of the App update allowing to specify subdomain. */ + interface WithSubdomain { + /** + * Specifies the subdomain property: The subdomain of the application.. + * + * @param subdomain The subdomain of the application. + * @return the next definition stage. + */ + Update withSubdomain(String subdomain); + } + /** The stage of the App update allowing to specify template. */ + interface WithTemplate { + /** + * Specifies the template property: The ID of the application template, which is a blueprint that defines + * the characteristics and behaviors of an application. Optional; if not specified, defaults to a blank + * blueprint and allows the application to be defined from scratch.. + * + * @param template The ID of the application template, which is a blueprint that defines the characteristics + * and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and allows + * the application to be defined from scratch. + * @return the next definition stage. + */ + Update withTemplate(String template); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + App refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + App refresh(Context context); +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppAvailabilityInfo.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppAvailabilityInfo.java new file mode 100644 index 0000000000000..e64f8dae63eda --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppAvailabilityInfo.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.iotcentral.models; + +import com.azure.resourcemanager.iotcentral.fluent.models.AppAvailabilityInfoInner; + +/** An immutable client-side representation of AppAvailabilityInfo. */ +public interface AppAvailabilityInfo { + /** + * 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. + */ + String reason(); + + /** + * Gets the message property: The detailed reason message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.iotcentral.fluent.models.AppAvailabilityInfoInner object. + * + * @return the inner object. + */ + AppAvailabilityInfoInner innerModel(); +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppListResult.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppListResult.java new file mode 100644 index 0000000000000..bcdabe9f44c42 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppListResult.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.iotcentral.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iotcentral.fluent.models.AppInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of IoT Central Applications with a next link. */ +@Fluent +public final class AppListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppListResult.class); + + /* + * The link used to get the next page of IoT Central Applications. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * A list of IoT Central Applications. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the nextLink property: The link used to get the next page of IoT Central Applications. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of IoT Central Applications. + * + * @param nextLink the nextLink value to set. + * @return the AppListResult object itself. + */ + public AppListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: A list of IoT Central Applications. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of IoT Central Applications. + * + * @param value the value value to set. + * @return the AppListResult object itself. + */ + public AppListResult 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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppPatch.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppPatch.java new file mode 100644 index 0000000000000..c5d7e4a9639fc --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppPatch.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The description of the IoT Central application. */ +@JsonFlatten +@Fluent +public class AppPatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppPatch.class); + + /* + * Instance tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * A valid instance SKU. + */ + @JsonProperty(value = "sku") + private AppSkuInfo sku; + + /* + * The ID of the application. + */ + @JsonProperty(value = "properties.applicationId", access = JsonProperty.Access.WRITE_ONLY) + private String applicationId; + + /* + * The display name of the application. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * The subdomain of the application. + */ + @JsonProperty(value = "properties.subdomain") + private String subdomain; + + /* + * The ID of the application template, which is a blueprint that defines + * the characteristics and behaviors of an application. Optional; if not + * specified, defaults to a blank blueprint and allows the application to + * be defined from scratch. + */ + @JsonProperty(value = "properties.template") + private String template; + + /** + * Get the tags property: Instance tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Instance tags. + * + * @param tags the tags value to set. + * @return the AppPatch object itself. + */ + public AppPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the sku property: A valid instance SKU. + * + * @return the sku value. + */ + public AppSkuInfo sku() { + return this.sku; + } + + /** + * Set the sku property: A valid instance SKU. + * + * @param sku the sku value to set. + * @return the AppPatch object itself. + */ + public AppPatch withSku(AppSkuInfo sku) { + this.sku = sku; + return this; + } + + /** + * Get the applicationId property: The ID of the application. + * + * @return the applicationId value. + */ + public String applicationId() { + return this.applicationId; + } + + /** + * Get the displayName property: The display name of the application. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the application. + * + * @param displayName the displayName value to set. + * @return the AppPatch object itself. + */ + public AppPatch withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the subdomain property: The subdomain of the application. + * + * @return the subdomain value. + */ + public String subdomain() { + return this.subdomain; + } + + /** + * Set the subdomain property: The subdomain of the application. + * + * @param subdomain the subdomain value to set. + * @return the AppPatch object itself. + */ + public AppPatch withSubdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + /** + * Get the template property: The ID of the application template, which is a blueprint that defines the + * characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and + * allows the application to be defined from scratch. + * + * @return the template value. + */ + public String template() { + return this.template; + } + + /** + * Set the template property: The ID of the application template, which is a blueprint that defines the + * characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and + * allows the application to be defined from scratch. + * + * @param template the template value to set. + * @return the AppPatch object itself. + */ + public AppPatch withTemplate(String template) { + this.template = template; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppSku.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppSku.java new file mode 100644 index 0000000000000..c379395ff5a3d --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppSku.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.iotcentral.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AppSku. */ +public final class AppSku extends ExpandableStringEnum { + /** Static value F1 for AppSku. */ + public static final AppSku F1 = fromString("F1"); + + /** Static value S1 for AppSku. */ + public static final AppSku S1 = fromString("S1"); + + /** Static value ST0 for AppSku. */ + public static final AppSku ST0 = fromString("ST0"); + + /** Static value ST1 for AppSku. */ + public static final AppSku ST1 = fromString("ST1"); + + /** Static value ST2 for AppSku. */ + public static final AppSku ST2 = fromString("ST2"); + + /** + * Creates or finds a AppSku from its string representation. + * + * @param name a name to look for. + * @return the corresponding AppSku. + */ + @JsonCreator + public static AppSku fromString(String name) { + return fromString(name, AppSku.class); + } + + /** @return known AppSku values. */ + public static Collection values() { + return values(AppSku.class); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppSkuInfo.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppSkuInfo.java new file mode 100644 index 0000000000000..a928a2581a9be --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppSkuInfo.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.iotcentral.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 Central application. */ +@Fluent +public final class AppSkuInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppSkuInfo.class); + + /* + * The name of the SKU. + */ + @JsonProperty(value = "name", required = true) + private AppSku name; + + /** + * Get the name property: The name of the SKU. + * + * @return the name value. + */ + public AppSku name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. + * + * @param name the name value to set. + * @return the AppSkuInfo object itself. + */ + public AppSkuInfo withName(AppSku 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 AppSkuInfo")); + } + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppTemplate.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppTemplate.java new file mode 100644 index 0000000000000..27fefc545a839 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppTemplate.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.iotcentral.models; + +import com.azure.resourcemanager.iotcentral.fluent.models.AppTemplateInner; + +/** An immutable client-side representation of AppTemplate. */ +public interface AppTemplate { + /** + * Gets the manifestId property: The ID of the template. + * + * @return the manifestId value. + */ + String manifestId(); + + /** + * Gets the manifestVersion property: The version of the template. + * + * @return the manifestVersion value. + */ + String manifestVersion(); + + /** + * Gets the name property: The name of the template. + * + * @return the name value. + */ + String name(); + + /** + * Gets the title property: The title of the template. + * + * @return the title value. + */ + String title(); + + /** + * Gets the order property: The order of the template in the templates list. + * + * @return the order value. + */ + Float order(); + + /** + * Gets the description property: The description of the template. + * + * @return the description value. + */ + String description(); + + /** + * Gets the inner com.azure.resourcemanager.iotcentral.fluent.models.AppTemplateInner object. + * + * @return the inner object. + */ + AppTemplateInner innerModel(); +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppTemplatesResult.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppTemplatesResult.java new file mode 100644 index 0000000000000..8823986122119 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppTemplatesResult.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.iotcentral.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iotcentral.fluent.models.AppTemplateInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of IoT Central Application Templates with a next link. */ +@Fluent +public final class AppTemplatesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppTemplatesResult.class); + + /* + * The link used to get the next page of IoT Central application templates. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * A list of IoT Central Application Templates. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the nextLink property: The link used to get the next page of IoT Central application templates. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of IoT Central application templates. + * + * @param nextLink the nextLink value to set. + * @return the AppTemplatesResult object itself. + */ + public AppTemplatesResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: A list of IoT Central Application Templates. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Apps.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Apps.java new file mode 100644 index 0000000000000..7683857c7fc24 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Apps.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.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 Apps. */ +public interface Apps { + /** + * Get the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + App getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Get the metadata of an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String resourceName, Context context); + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Delete an IoT Central application. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String resourceName, Context context); + + /** + * Get all IoT Central Applications in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all IoT Central Applications in a subscription. + */ + PagedIterable list(); + + /** + * Get all IoT Central Applications in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all IoT Central Applications in a subscription. + */ + PagedIterable list(Context context); + + /** + * Get all the IoT Central Applications in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the IoT Central Applications in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get all the IoT Central Applications in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the IoT Central Applications in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Check if an IoT Central application name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central + * application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Central application name or subdomain is available. + */ + AppAvailabilityInfo checkNameAvailability(OperationInputs operationInputs); + + /** + * Check if an IoT Central application name is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the IoT Central + * application to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Central application name or subdomain is available. + */ + Response checkNameAvailabilityWithResponse(OperationInputs operationInputs, Context context); + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT + * Central application to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Central application name or subdomain is available. + */ + AppAvailabilityInfo checkSubdomainAvailability(OperationInputs operationInputs); + + /** + * Check if an IoT Central application subdomain is available. + * + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT + * Central application to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Central application name or subdomain is available. + */ + Response checkSubdomainAvailabilityWithResponse( + OperationInputs operationInputs, Context context); + + /** + * Get all available application templates. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available application templates. + */ + PagedIterable listTemplates(); + + /** + * Get all available application templates. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all available application templates. + */ + PagedIterable listTemplates(Context context); + + /** + * Get the metadata of an IoT Central application. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + App getById(String id); + + /** + * Get the metadata of an IoT Central application. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of an IoT Central application. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an IoT Central application. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an IoT Central application. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new App resource. + * + * @param name resource name. + * @return the first stage of the new App definition. + */ + App.DefinitionStages.Blank define(String name); +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/CloudErrorBody.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/CloudErrorBody.java new file mode 100644 index 0000000000000..006e23fd31367 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/CloudErrorBody.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.iotcentral.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; + +/** Details of error response. */ +@Fluent +public final class CloudErrorBody { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudErrorBody.class); + + /* + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * The target of the particular error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /* + * A list of additional details about the error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the target property: The target of the particular error. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Get the details property: A list of additional details about the error. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Set the details property: A list of additional details about the error. + * + * @param details the details value to set. + * @return the CloudErrorBody object itself. + */ + public CloudErrorBody withDetails(List 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().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Operation.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Operation.java new file mode 100644 index 0000000000000..0ed13755f9618 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/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.iotcentral.models; + +import com.azure.resourcemanager.iotcentral.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.iotcentral.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/OperationDisplay.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/OperationDisplay.java new file mode 100644 index 0000000000000..00feacd57fdda --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/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.iotcentral.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 IoT Central + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * Resource Type: IoT Central + */ + @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; + + /* + * Friendly description for the operation, + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: Service provider: Microsoft IoT Central. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: Resource Type: IoT Central. + * + * @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: Friendly description for 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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/OperationInputs.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/OperationInputs.java new file mode 100644 index 0000000000000..1c8126d3ce6ee --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/OperationInputs.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.iotcentral.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 Central application instance to check. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The type of the IoT Central resource to query. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name property: The name of the IoT Central application instance to check. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the IoT Central application instance to check. + * + * @param name the name value to set. + * @return the OperationInputs object itself. + */ + public OperationInputs withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type of the IoT Central resource to query. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of the IoT Central resource to query. + * + * @param type the type value to set. + * @return the OperationInputs object itself. + */ + public OperationInputs withType(String type) { + this.type = type; + 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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/OperationListResult.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/OperationListResult.java new file mode 100644 index 0000000000000..6b4ba5a6c00e2 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/OperationListResult.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iotcentral.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of IoT Central operations. It contains a list of operations and a URL link to get the next set of results. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * The link used to get the next page of IoT Central description objects. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * A list of operations supported by the Microsoft.IoTCentral resource + * provider. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the nextLink property: The link used to get the next page of IoT Central description objects. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of IoT Central description objects. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: A list of operations supported by the Microsoft.IoTCentral resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Operations.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Operations.java new file mode 100644 index 0000000000000..dd5fcf5ea78f6 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.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 Central application REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central operations. + */ + PagedIterable list(); + + /** + * Lists all of the available IoT Central application REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IoT Central operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/package-info.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/package-info.java new file mode 100644 index 0000000000000..9fbbcbf8d6d6d --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for IotCentralClient. Use this API to manage IoT Central Applications in your + * Azure subscription. + */ +package com.azure.resourcemanager.iotcentral.models; diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/package-info.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/package-info.java new file mode 100644 index 0000000000000..065dd5e298493 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for IotCentralClient. Use this API to manage IoT Central Applications in your Azure + * subscription. + */ +package com.azure.resourcemanager.iotcentral; diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/module-info.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/module-info.java new file mode 100644 index 0000000000000..46c45813a3186 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/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.iotcentral { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.iotcentral; + exports com.azure.resourcemanager.iotcentral.fluent; + exports com.azure.resourcemanager.iotcentral.fluent.models; + exports com.azure.resourcemanager.iotcentral.models; + + opens com.azure.resourcemanager.iotcentral.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.iotcentral.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/iotcentral/ci.yml b/sdk/iotcentral/ci.yml new file mode 100644 index 0000000000000..55764b2a8d058 --- /dev/null +++ b/sdk/iotcentral/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/iotcentral/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iotcentral/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: iotcentral + Artifacts: + - name: azure-resourcemanager-iotcentral + groupId: com.azure.resourcemanager + safeName: azureresourcemanageriotcentral diff --git a/sdk/iotcentral/pom.xml b/sdk/iotcentral/pom.xml new file mode 100644 index 0000000000000..bcdab1f957d5f --- /dev/null +++ b/sdk/iotcentral/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-iotcentral-service + pom + 1.0.0 + + azure-resourcemanager-iotcentral + +