diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 90aecf6b32a62..51e7521293dca 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -185,6 +185,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-mixedreality;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..b676a147f9d44 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,7 @@ sdk/loganalytics sdk/mediaservices sdk/metricsadvisor + sdk/mixedreality sdk/monitor sdk/mysql sdk/postgresql diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/CHANGELOG.md b/sdk/mixedreality/azure-resourcemanager-mixedreality/CHANGELOG.md new file mode 100644 index 0000000000000..2aac661c596ad --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-23) + +- Azure Resource Manager MixedReality client library for Java. This package contains Microsoft Azure SDK for MixedReality Management SDK. Mixed Reality Client. Package tag package-2020-05. 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/mixedreality/azure-resourcemanager-mixedreality/README.md b/sdk/mixedreality/azure-resourcemanager-mixedreality/README.md new file mode 100644 index 0000000000000..e98ac357db1bd --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/README.md @@ -0,0 +1,83 @@ +# Azure Resource Manager MixedReality client library for Java + +Azure Resource Manager MixedReality client library for Java. + +This package contains Microsoft Azure SDK for MixedReality Management SDK. Mixed Reality Client. Package tag package-2020-05. 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-mixedreality;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-mixedreality + 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(); +MixedRealityManager manager = MixedRealityManager + .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/mixedreality/azure-resourcemanager-mixedreality/pom.xml b/sdk/mixedreality/azure-resourcemanager-mixedreality/pom.xml new file mode 100644 index 0000000000000..8e1ad3e7b1d71 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/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-mixedreality + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for MixedReality Management + This package contains Microsoft Azure SDK for MixedReality Management SDK. Mixed Reality Client. Package tag package-2020-05. 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/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/MixedRealityManager.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/MixedRealityManager.java new file mode 100644 index 0000000000000..1d757a6cf45b1 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/MixedRealityManager.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality; + +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.mixedreality.fluent.MixedRealityClient; +import com.azure.resourcemanager.mixedreality.implementation.MixedRealityClientBuilder; +import com.azure.resourcemanager.mixedreality.implementation.OperationsImpl; +import com.azure.resourcemanager.mixedreality.implementation.RemoteRenderingAccountsImpl; +import com.azure.resourcemanager.mixedreality.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.mixedreality.implementation.SpatialAnchorsAccountsImpl; +import com.azure.resourcemanager.mixedreality.models.Operations; +import com.azure.resourcemanager.mixedreality.models.RemoteRenderingAccounts; +import com.azure.resourcemanager.mixedreality.models.ResourceProviders; +import com.azure.resourcemanager.mixedreality.models.SpatialAnchorsAccounts; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to MixedRealityManager. Mixed Reality Client. */ +public final class MixedRealityManager { + private Operations operations; + + private ResourceProviders resourceProviders; + + private SpatialAnchorsAccounts spatialAnchorsAccounts; + + private RemoteRenderingAccounts remoteRenderingAccounts; + + private final MixedRealityClient clientObject; + + private MixedRealityManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MixedRealityClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of MixedReality service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the MixedReality service API instance. + */ + public static MixedRealityManager 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 MixedRealityManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MixedRealityManager.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 MixedReality service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the MixedReality service API instance. + */ + public MixedRealityManager 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.mixedreality", + "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 MixedRealityManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of SpatialAnchorsAccounts. */ + public SpatialAnchorsAccounts spatialAnchorsAccounts() { + if (this.spatialAnchorsAccounts == null) { + this.spatialAnchorsAccounts = + new SpatialAnchorsAccountsImpl(clientObject.getSpatialAnchorsAccounts(), this); + } + return spatialAnchorsAccounts; + } + + /** @return Resource collection API of RemoteRenderingAccounts. */ + public RemoteRenderingAccounts remoteRenderingAccounts() { + if (this.remoteRenderingAccounts == null) { + this.remoteRenderingAccounts = + new RemoteRenderingAccountsImpl(clientObject.getRemoteRenderingAccounts(), this); + } + return remoteRenderingAccounts; + } + + /** + * @return Wrapped service client MixedRealityClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public MixedRealityClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/MixedRealityClient.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/MixedRealityClient.java new file mode 100644 index 0000000000000..bae3904453f37 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/MixedRealityClient.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.mixedreality.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MixedRealityClient class. */ +public interface MixedRealityClient { + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the SpatialAnchorsAccountsClient object to access its operations. + * + * @return the SpatialAnchorsAccountsClient object. + */ + SpatialAnchorsAccountsClient getSpatialAnchorsAccounts(); + + /** + * Gets the RemoteRenderingAccountsClient object to access its operations. + * + * @return the RemoteRenderingAccountsClient object. + */ + RemoteRenderingAccountsClient getRemoteRenderingAccounts(); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/OperationsClient.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/OperationsClient.java new file mode 100644 index 0000000000000..727bf29a6e7f3 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/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.mixedreality.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.mixedreality.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Exposing Available 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 result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Exposing Available 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 result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/RemoteRenderingAccountsClient.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/RemoteRenderingAccountsClient.java new file mode 100644 index 0000000000000..e1891b2ff5743 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/RemoteRenderingAccountsClient.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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.util.Context; +import com.azure.resourcemanager.mixedreality.fluent.models.AccountKeysInner; +import com.azure.resourcemanager.mixedreality.fluent.models.RemoteRenderingAccountInner; +import com.azure.resourcemanager.mixedreality.models.AccountKeyRegenerateRequest; + +/** An instance of this class provides access to all the operations defined in RemoteRenderingAccountsClient. */ +public interface RemoteRenderingAccountsClient { + /** + * List Remote Rendering Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Remote Rendering Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Delete a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName); + + /** + * Delete a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Retrieve a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemoteRenderingAccountInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Retrieve a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account parameter. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemoteRenderingAccountInner update( + String resourceGroupName, String accountName, RemoteRenderingAccountInner remoteRenderingAccount); + + /** + * Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account parameter. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String accountName, + RemoteRenderingAccountInner remoteRenderingAccount, + Context context); + + /** + * Creating or Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account parameter. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemoteRenderingAccountInner create( + String resourceGroupName, String accountName, RemoteRenderingAccountInner remoteRenderingAccount); + + /** + * Creating or Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account parameter. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String accountName, + RemoteRenderingAccountInner remoteRenderingAccount, + Context context); + + /** + * List Both of the 2 Keys of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountKeysInner listKeys(String resourceGroupName, String accountName); + + /** + * List Both of the 2 Keys of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listKeysWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Regenerate specified Key of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountKeysInner regenerateKeys( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate); + + /** + * Regenerate specified Key of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response regenerateKeysWithResponse( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate, Context context); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/ResourceProvidersClient.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..30f717be6fe44 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/ResourceProvidersClient.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mixedreality.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mixedreality.models.CheckNameAvailabilityRequest; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Check Name Availability for local uniqueness. + * + * @param location The location in which uniqueness will be verified. + * @param checkNameAvailability Check Name Availability Request. + * @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 check Name Availability Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkNameAvailabilityLocal( + String location, CheckNameAvailabilityRequest checkNameAvailability); + + /** + * Check Name Availability for local uniqueness. + * + * @param location The location in which uniqueness will be verified. + * @param checkNameAvailability Check Name Availability Request. + * @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 check Name Availability Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityLocalWithResponse( + String location, CheckNameAvailabilityRequest checkNameAvailability, Context context); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/SpatialAnchorsAccountsClient.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/SpatialAnchorsAccountsClient.java new file mode 100644 index 0000000000000..bd933fec73826 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/SpatialAnchorsAccountsClient.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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.util.Context; +import com.azure.resourcemanager.mixedreality.fluent.models.AccountKeysInner; +import com.azure.resourcemanager.mixedreality.fluent.models.SpatialAnchorsAccountInner; +import com.azure.resourcemanager.mixedreality.models.AccountKeyRegenerateRequest; + +/** An instance of this class provides access to all the operations defined in SpatialAnchorsAccountsClient. */ +public interface SpatialAnchorsAccountsClient { + /** + * List Spatial Anchors Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Spatial Anchors Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Delete a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName); + + /** + * Delete a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Retrieve a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SpatialAnchorsAccountInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Retrieve a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account parameter. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SpatialAnchorsAccountInner update( + String resourceGroupName, String accountName, SpatialAnchorsAccountInner spatialAnchorsAccount); + + /** + * Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account parameter. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String accountName, + SpatialAnchorsAccountInner spatialAnchorsAccount, + Context context); + + /** + * Creating or Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account parameter. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SpatialAnchorsAccountInner create( + String resourceGroupName, String accountName, SpatialAnchorsAccountInner spatialAnchorsAccount); + + /** + * Creating or Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account parameter. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String accountName, + SpatialAnchorsAccountInner spatialAnchorsAccount, + Context context); + + /** + * List Both of the 2 Keys of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountKeysInner listKeys(String resourceGroupName, String accountName); + + /** + * List Both of the 2 Keys of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listKeysWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Regenerate specified Key of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountKeysInner regenerateKeys( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate); + + /** + * Regenerate specified Key of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response regenerateKeysWithResponse( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate, Context context); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/AccountKeysInner.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/AccountKeysInner.java new file mode 100644 index 0000000000000..2e41d0d0a1973 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/AccountKeysInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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; + +/** Developer Keys of account. */ +@Immutable +public final class AccountKeysInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountKeysInner.class); + + /* + * value of primary key. + */ + @JsonProperty(value = "primaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryKey; + + /* + * value of secondary key. + */ + @JsonProperty(value = "secondaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryKey; + + /** + * Get the primaryKey property: value of primary key. + * + * @return the primaryKey value. + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Get the secondaryKey property: value of secondary key. + * + * @return the secondaryKey value. + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..069eb1baef20f --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mixedreality.models.NameAvailability; +import com.azure.resourcemanager.mixedreality.models.NameUnavailableReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Check Name Availability Response. */ +@Fluent +public final class CheckNameAvailabilityResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResponseInner.class); + + /* + * if name Available + */ + @JsonProperty(value = "nameAvailable", required = true) + private NameAvailability nameAvailable; + + /* + * Resource Name To Verify + */ + @JsonProperty(value = "reason") + private NameUnavailableReason reason; + + /* + * detail message + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable property: if name Available. + * + * @return the nameAvailable value. + */ + public NameAvailability nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: if name Available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withNameAvailable(NameAvailability nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: Resource Name To Verify. + * + * @return the reason value. + */ + public NameUnavailableReason reason() { + return this.reason; + } + + /** + * Set the reason property: Resource Name To Verify. + * + * @param reason the reason value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withReason(NameUnavailableReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: detail message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: detail message. + * + * @param message the message value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (nameAvailable() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property nameAvailable in model CheckNameAvailabilityResponseInner")); + } + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/OperationInner.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..da59f71fb98d9 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/OperationInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mixedreality.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * 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/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/RemoteRenderingAccountInner.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/RemoteRenderingAccountInner.java new file mode 100644 index 0000000000000..b7bf43cf9a067 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/RemoteRenderingAccountInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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.mixedreality.models.Identity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** RemoteRenderingAccount Response. */ +@JsonFlatten +@Fluent +public class RemoteRenderingAccountInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemoteRenderingAccountInner.class); + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * unique id of certain account. + */ + @JsonProperty(value = "properties.accountId", access = JsonProperty.Access.WRITE_ONLY) + private String accountId; + + /* + * Correspond domain name of certain Spatial Anchors Account + */ + @JsonProperty(value = "properties.accountDomain", access = JsonProperty.Access.WRITE_ONLY) + private String accountDomain; + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the RemoteRenderingAccountInner object itself. + */ + public RemoteRenderingAccountInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the accountId property: unique id of certain account. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the accountDomain property: Correspond domain name of certain Spatial Anchors Account. + * + * @return the accountDomain value. + */ + public String accountDomain() { + return this.accountDomain; + } + + /** {@inheritDoc} */ + @Override + public RemoteRenderingAccountInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public RemoteRenderingAccountInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/SpatialAnchorsAccountInner.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/SpatialAnchorsAccountInner.java new file mode 100644 index 0000000000000..f95a2c09c3041 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/SpatialAnchorsAccountInner.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** SpatialAnchorsAccount Response. */ +@JsonFlatten +@Immutable +public class SpatialAnchorsAccountInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SpatialAnchorsAccountInner.class); + + /* + * unique id of certain account. + */ + @JsonProperty(value = "properties.accountId", access = JsonProperty.Access.WRITE_ONLY) + private String accountId; + + /* + * Correspond domain name of certain Spatial Anchors Account + */ + @JsonProperty(value = "properties.accountDomain", access = JsonProperty.Access.WRITE_ONLY) + private String accountDomain; + + /** + * Get the accountId property: unique id of certain account. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the accountDomain property: Correspond domain name of certain Spatial Anchors Account. + * + * @return the accountDomain value. + */ + public String accountDomain() { + return this.accountDomain; + } + + /** {@inheritDoc} */ + @Override + public SpatialAnchorsAccountInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SpatialAnchorsAccountInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/package-info.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/package-info.java new file mode 100644 index 0000000000000..2f89e12a4466a --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for MixedRealityClient. Mixed Reality Client. */ +package com.azure.resourcemanager.mixedreality.fluent.models; diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/package-info.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/package-info.java new file mode 100644 index 0000000000000..8278c870a7d9c --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for MixedRealityClient. Mixed Reality Client. */ +package com.azure.resourcemanager.mixedreality.fluent; diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/AccountKeysImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/AccountKeysImpl.java new file mode 100644 index 0000000000000..ae19db6b0d6b4 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/AccountKeysImpl.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.mixedreality.implementation; + +import com.azure.resourcemanager.mixedreality.MixedRealityManager; +import com.azure.resourcemanager.mixedreality.fluent.models.AccountKeysInner; +import com.azure.resourcemanager.mixedreality.models.AccountKeys; + +public final class AccountKeysImpl implements AccountKeys { + private AccountKeysInner innerObject; + + private final MixedRealityManager serviceManager; + + AccountKeysImpl(AccountKeysInner innerObject, MixedRealityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String primaryKey() { + return this.innerModel().primaryKey(); + } + + public String secondaryKey() { + return this.innerModel().secondaryKey(); + } + + public AccountKeysInner innerModel() { + return this.innerObject; + } + + private MixedRealityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..7da331d341b97 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/CheckNameAvailabilityResponseImpl.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.mixedreality.implementation; + +import com.azure.resourcemanager.mixedreality.MixedRealityManager; +import com.azure.resourcemanager.mixedreality.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mixedreality.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.mixedreality.models.NameAvailability; +import com.azure.resourcemanager.mixedreality.models.NameUnavailableReason; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final MixedRealityManager serviceManager; + + CheckNameAvailabilityResponseImpl( + CheckNameAvailabilityResponseInner innerObject, MixedRealityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public NameAvailability nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public NameUnavailableReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private MixedRealityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/MixedRealityClientBuilder.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/MixedRealityClientBuilder.java new file mode 100644 index 0000000000000..13fe10f9973ed --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/MixedRealityClientBuilder.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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 MixedRealityClientImpl type. */ +@ServiceClientBuilder(serviceClients = {MixedRealityClientImpl.class}) +public final class MixedRealityClientBuilder { + /* + * The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000) + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the MixedRealityClientBuilder. + */ + public MixedRealityClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MixedRealityClientBuilder. + */ + public MixedRealityClientBuilder 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 MixedRealityClientBuilder. + */ + public MixedRealityClientBuilder 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 MixedRealityClientBuilder. + */ + public MixedRealityClientBuilder 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 MixedRealityClientBuilder. + */ + public MixedRealityClientBuilder 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 MixedRealityClientBuilder. + */ + public MixedRealityClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MixedRealityClientImpl with the provided parameters. + * + * @return an instance of MixedRealityClientImpl. + */ + public MixedRealityClientImpl 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(); + } + MixedRealityClientImpl client = + new MixedRealityClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/MixedRealityClientImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/MixedRealityClientImpl.java new file mode 100644 index 0000000000000..e26e72462495e --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/MixedRealityClientImpl.java @@ -0,0 +1,323 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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.mixedreality.fluent.MixedRealityClient; +import com.azure.resourcemanager.mixedreality.fluent.OperationsClient; +import com.azure.resourcemanager.mixedreality.fluent.RemoteRenderingAccountsClient; +import com.azure.resourcemanager.mixedreality.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.mixedreality.fluent.SpatialAnchorsAccountsClient; +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 MixedRealityClientImpl type. */ +@ServiceClient(builder = MixedRealityClientBuilder.class) +public final class MixedRealityClientImpl implements MixedRealityClient { + private final ClientLogger logger = new ClientLogger(MixedRealityClientImpl.class); + + /** The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The SpatialAnchorsAccountsClient object to access its operations. */ + private final SpatialAnchorsAccountsClient spatialAnchorsAccounts; + + /** + * Gets the SpatialAnchorsAccountsClient object to access its operations. + * + * @return the SpatialAnchorsAccountsClient object. + */ + public SpatialAnchorsAccountsClient getSpatialAnchorsAccounts() { + return this.spatialAnchorsAccounts; + } + + /** The RemoteRenderingAccountsClient object to access its operations. */ + private final RemoteRenderingAccountsClient remoteRenderingAccounts; + + /** + * Gets the RemoteRenderingAccountsClient object to access its operations. + * + * @return the RemoteRenderingAccountsClient object. + */ + public RemoteRenderingAccountsClient getRemoteRenderingAccounts() { + return this.remoteRenderingAccounts; + } + + /** + * Initializes an instance of MixedRealityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + MixedRealityClientImpl( + 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.operations = new OperationsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.spatialAnchorsAccounts = new SpatialAnchorsAccountsClientImpl(this); + this.remoteRenderingAccounts = new RemoteRenderingAccountsClientImpl(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/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/OperationImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/OperationImpl.java new file mode 100644 index 0000000000000..abd7abc7e1283 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/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.mixedreality.implementation; + +import com.azure.resourcemanager.mixedreality.MixedRealityManager; +import com.azure.resourcemanager.mixedreality.fluent.models.OperationInner; +import com.azure.resourcemanager.mixedreality.models.Operation; +import com.azure.resourcemanager.mixedreality.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final MixedRealityManager serviceManager; + + OperationImpl(OperationInner innerObject, MixedRealityManager 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 MixedRealityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/OperationsClientImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..a83a4c0191c28 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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.mixedreality.fluent.OperationsClient; +import com.azure.resourcemanager.mixedreality.fluent.models.OperationInner; +import com.azure.resourcemanager.mixedreality.models.OperationPage; +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 MixedRealityClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MixedRealityClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MixedRealityClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MixedRealityClientOp") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.MixedReality/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); + } + + /** + * Exposing Available 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 result of the request to list Resource Provider 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 apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, 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()))); + } + + /** + * Exposing Available 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 result of the request to list Resource Provider 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 apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Exposing Available 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 result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Exposing Available 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 result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Exposing Available 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 result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Exposing Available 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 result of the request to list Resource Provider 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 result of the request to list Resource Provider 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 result of the request to list Resource Provider 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/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/OperationsImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..8b947735ca69b --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/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.mixedreality.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.mixedreality.MixedRealityManager; +import com.azure.resourcemanager.mixedreality.fluent.OperationsClient; +import com.azure.resourcemanager.mixedreality.fluent.models.OperationInner; +import com.azure.resourcemanager.mixedreality.models.Operation; +import com.azure.resourcemanager.mixedreality.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 MixedRealityManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, MixedRealityManager 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 MixedRealityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/RemoteRenderingAccountImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/RemoteRenderingAccountImpl.java new file mode 100644 index 0000000000000..ba7dcbbfea31a --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/RemoteRenderingAccountImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mixedreality.MixedRealityManager; +import com.azure.resourcemanager.mixedreality.fluent.models.RemoteRenderingAccountInner; +import com.azure.resourcemanager.mixedreality.models.Identity; +import com.azure.resourcemanager.mixedreality.models.RemoteRenderingAccount; +import java.util.Collections; +import java.util.Map; + +public final class RemoteRenderingAccountImpl + implements RemoteRenderingAccount, RemoteRenderingAccount.Definition, RemoteRenderingAccount.Update { + private RemoteRenderingAccountInner innerObject; + + private final MixedRealityManager 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 Identity identity() { + return this.innerModel().identity(); + } + + public String accountId() { + return this.innerModel().accountId(); + } + + public String accountDomain() { + return this.innerModel().accountDomain(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public RemoteRenderingAccountInner innerModel() { + return this.innerObject; + } + + private MixedRealityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + public RemoteRenderingAccountImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public RemoteRenderingAccount create() { + this.innerObject = + serviceManager + .serviceClient() + .getRemoteRenderingAccounts() + .createWithResponse(resourceGroupName, accountName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public RemoteRenderingAccount create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRemoteRenderingAccounts() + .createWithResponse(resourceGroupName, accountName, this.innerModel(), context) + .getValue(); + return this; + } + + RemoteRenderingAccountImpl(String name, MixedRealityManager serviceManager) { + this.innerObject = new RemoteRenderingAccountInner(); + this.serviceManager = serviceManager; + this.accountName = name; + } + + public RemoteRenderingAccountImpl update() { + return this; + } + + public RemoteRenderingAccount apply() { + this.innerObject = + serviceManager + .serviceClient() + .getRemoteRenderingAccounts() + .updateWithResponse(resourceGroupName, accountName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public RemoteRenderingAccount apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRemoteRenderingAccounts() + .updateWithResponse(resourceGroupName, accountName, this.innerModel(), context) + .getValue(); + return this; + } + + RemoteRenderingAccountImpl(RemoteRenderingAccountInner innerObject, MixedRealityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "remoteRenderingAccounts"); + } + + public RemoteRenderingAccount refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getRemoteRenderingAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public RemoteRenderingAccount refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRemoteRenderingAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public RemoteRenderingAccountImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public RemoteRenderingAccountImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public RemoteRenderingAccountImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public RemoteRenderingAccountImpl withIdentity(Identity identity) { + this.innerModel().withIdentity(identity); + return this; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/RemoteRenderingAccountsClientImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/RemoteRenderingAccountsClientImpl.java new file mode 100644 index 0000000000000..bd6e20a2644e6 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/RemoteRenderingAccountsClientImpl.java @@ -0,0 +1,1624 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mixedreality.fluent.RemoteRenderingAccountsClient; +import com.azure.resourcemanager.mixedreality.fluent.models.AccountKeysInner; +import com.azure.resourcemanager.mixedreality.fluent.models.RemoteRenderingAccountInner; +import com.azure.resourcemanager.mixedreality.models.AccountKeyRegenerateRequest; +import com.azure.resourcemanager.mixedreality.models.RemoteRenderingAccountPage; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RemoteRenderingAccountsClient. */ +public final class RemoteRenderingAccountsClientImpl implements RemoteRenderingAccountsClient { + private final ClientLogger logger = new ClientLogger(RemoteRenderingAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RemoteRenderingAccountsService service; + + /** The service client containing this operation class. */ + private final MixedRealityClientImpl client; + + /** + * Initializes an instance of RemoteRenderingAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RemoteRenderingAccountsClientImpl(MixedRealityClientImpl client) { + this.service = + RestProxy + .create(RemoteRenderingAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MixedRealityClientRemoteRenderingAccounts to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MixedRealityClientRe") + private interface RemoteRenderingAccountsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/remoteRenderingAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/remoteRenderingAccounts/{accountName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/remoteRenderingAccounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/remoteRenderingAccounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RemoteRenderingAccountInner remoteRenderingAccount, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/remoteRenderingAccounts/{accountName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RemoteRenderingAccountInner remoteRenderingAccount, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/remoteRenderingAccounts/{accountName}/listKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/remoteRenderingAccounts/{accountName}/regenerateKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> regenerateKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AccountKeyRegenerateRequest regenerate, + @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); + } + + /** + * List Remote Rendering Accounts by 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 result of the request to get resource collection. + */ + @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 apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List Remote Rendering Accounts by 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 result of the request to get resource collection. + */ + @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 apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Remote Rendering Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Remote Rendering Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List Remote Rendering Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List Remote Rendering Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @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 apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @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 apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Delete a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context); + } + + /** + * Delete a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName) { + return deleteWithResponseAsync(resourceGroupName, accountName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName) { + deleteAsync(resourceGroupName, accountName).block(); + } + + /** + * Delete a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String accountName, Context context) { + return deleteWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Retrieve a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieve a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context); + } + + /** + * Retrieve a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieve a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemoteRenderingAccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupAsync(resourceGroupName, accountName).block(); + } + + /** + * Retrieve a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account 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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String accountName, RemoteRenderingAccountInner remoteRenderingAccount) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (remoteRenderingAccount == null) { + return Mono + .error( + new IllegalArgumentException("Parameter remoteRenderingAccount is required and cannot be null.")); + } else { + remoteRenderingAccount.validate(); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + remoteRenderingAccount, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account 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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String accountName, + RemoteRenderingAccountInner remoteRenderingAccount, + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (remoteRenderingAccount == null) { + return Mono + .error( + new IllegalArgumentException("Parameter remoteRenderingAccount is required and cannot be null.")); + } else { + remoteRenderingAccount.validate(); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + remoteRenderingAccount, + accept, + context); + } + + /** + * Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account 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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, RemoteRenderingAccountInner remoteRenderingAccount) { + return updateWithResponseAsync(resourceGroupName, accountName, remoteRenderingAccount) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account 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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemoteRenderingAccountInner update( + String resourceGroupName, String accountName, RemoteRenderingAccountInner remoteRenderingAccount) { + return updateAsync(resourceGroupName, accountName, remoteRenderingAccount).block(); + } + + /** + * Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account 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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String accountName, + RemoteRenderingAccountInner remoteRenderingAccount, + Context context) { + return updateWithResponseAsync(resourceGroupName, accountName, remoteRenderingAccount, context).block(); + } + + /** + * Creating or Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account 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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String accountName, RemoteRenderingAccountInner remoteRenderingAccount) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (remoteRenderingAccount == null) { + return Mono + .error( + new IllegalArgumentException("Parameter remoteRenderingAccount is required and cannot be null.")); + } else { + remoteRenderingAccount.validate(); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + remoteRenderingAccount, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creating or Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account 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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String accountName, + RemoteRenderingAccountInner remoteRenderingAccount, + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (remoteRenderingAccount == null) { + return Mono + .error( + new IllegalArgumentException("Parameter remoteRenderingAccount is required and cannot be null.")); + } else { + remoteRenderingAccount.validate(); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + remoteRenderingAccount, + accept, + context); + } + + /** + * Creating or Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account 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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String accountName, RemoteRenderingAccountInner remoteRenderingAccount) { + return createWithResponseAsync(resourceGroupName, accountName, remoteRenderingAccount) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creating or Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account 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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemoteRenderingAccountInner create( + String resourceGroupName, String accountName, RemoteRenderingAccountInner remoteRenderingAccount) { + return createAsync(resourceGroupName, accountName, remoteRenderingAccount).block(); + } + + /** + * Creating or Updating a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param remoteRenderingAccount Remote Rendering Account 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 remoteRenderingAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String accountName, + RemoteRenderingAccountInner remoteRenderingAccount, + Context context) { + return createWithResponseAsync(resourceGroupName, accountName, remoteRenderingAccount, context).block(); + } + + /** + * List Both of the 2 Keys of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync(String resourceGroupName, String accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List Both of the 2 Keys of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync( + String resourceGroupName, String accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context); + } + + /** + * List Both of the 2 Keys of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listKeysAsync(String resourceGroupName, String accountName) { + return listKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List Both of the 2 Keys of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountKeysInner listKeys(String resourceGroupName, String accountName) { + return listKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * List Both of the 2 Keys of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return listKeysWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Regenerate specified Key of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeysWithResponseAsync( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regenerate == null) { + return Mono.error(new IllegalArgumentException("Parameter regenerate is required and cannot be null.")); + } else { + regenerate.validate(); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .regenerateKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + regenerate, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Regenerate specified Key of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeysWithResponseAsync( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regenerate == null) { + return Mono.error(new IllegalArgumentException("Parameter regenerate is required and cannot be null.")); + } else { + regenerate.validate(); + } + final String apiVersion = "2020-04-06-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .regenerateKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + regenerate, + accept, + context); + } + + /** + * Regenerate specified Key of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeysAsync( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate) { + return regenerateKeysWithResponseAsync(resourceGroupName, accountName, regenerate) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate specified Key of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountKeysInner regenerateKeys( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate) { + return regenerateKeysAsync(resourceGroupName, accountName, regenerate).block(); + } + + /** + * Regenerate specified Key of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response regenerateKeysWithResponse( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate, Context context) { + return regenerateKeysWithResponseAsync(resourceGroupName, accountName, regenerate, context).block(); + } + + /** + * 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 result of the request to get resource collection. + */ + @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 result of the request to get resource collection. + */ + @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 result of the request to get resource collection. + */ + @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 result of the request to get resource collection. + */ + @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)); + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/RemoteRenderingAccountsImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/RemoteRenderingAccountsImpl.java new file mode 100644 index 0000000000000..f2f9185803d4f --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/RemoteRenderingAccountsImpl.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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.mixedreality.MixedRealityManager; +import com.azure.resourcemanager.mixedreality.fluent.RemoteRenderingAccountsClient; +import com.azure.resourcemanager.mixedreality.fluent.models.AccountKeysInner; +import com.azure.resourcemanager.mixedreality.fluent.models.RemoteRenderingAccountInner; +import com.azure.resourcemanager.mixedreality.models.AccountKeyRegenerateRequest; +import com.azure.resourcemanager.mixedreality.models.AccountKeys; +import com.azure.resourcemanager.mixedreality.models.RemoteRenderingAccount; +import com.azure.resourcemanager.mixedreality.models.RemoteRenderingAccounts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RemoteRenderingAccountsImpl implements RemoteRenderingAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemoteRenderingAccountsImpl.class); + + private final RemoteRenderingAccountsClient innerClient; + + private final MixedRealityManager serviceManager; + + public RemoteRenderingAccountsImpl(RemoteRenderingAccountsClient innerClient, MixedRealityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new RemoteRenderingAccountImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new RemoteRenderingAccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new RemoteRenderingAccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new RemoteRenderingAccountImpl(inner1, this.manager())); + } + + public void deleteByResourceGroup(String resourceGroupName, String accountName) { + this.serviceClient().delete(resourceGroupName, accountName); + } + + public Response deleteWithResponse(String resourceGroupName, String accountName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, accountName, context); + } + + public RemoteRenderingAccount getByResourceGroup(String resourceGroupName, String accountName) { + RemoteRenderingAccountInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, accountName); + if (inner != null) { + return new RemoteRenderingAccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemoteRenderingAccountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AccountKeys listKeys(String resourceGroupName, String accountName) { + AccountKeysInner inner = this.serviceClient().listKeys(resourceGroupName, accountName); + if (inner != null) { + return new AccountKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listKeysWithResponse(String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listKeysWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccountKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AccountKeys regenerateKeys( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate) { + AccountKeysInner inner = this.serviceClient().regenerateKeys(resourceGroupName, accountName, regenerate); + if (inner != null) { + return new AccountKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response regenerateKeysWithResponse( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate, Context context) { + Response inner = + this.serviceClient().regenerateKeysWithResponse(resourceGroupName, accountName, regenerate, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccountKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RemoteRenderingAccount 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 accountName = Utils.getValueFromIdByName(id, "remoteRenderingAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'remoteRenderingAccounts'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, 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 accountName = Utils.getValueFromIdByName(id, "remoteRenderingAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'remoteRenderingAccounts'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, 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 accountName = Utils.getValueFromIdByName(id, "remoteRenderingAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'remoteRenderingAccounts'.", + id))); + } + this.deleteWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + public Response 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 accountName = Utils.getValueFromIdByName(id, "remoteRenderingAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'remoteRenderingAccounts'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, accountName, context); + } + + private RemoteRenderingAccountsClient serviceClient() { + return this.innerClient; + } + + private MixedRealityManager manager() { + return this.serviceManager; + } + + public RemoteRenderingAccountImpl define(String name) { + return new RemoteRenderingAccountImpl(name, this.manager()); + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/ResourceProvidersClientImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..2d409d49f81d0 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.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.mixedreality.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.mixedreality.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mixedreality.models.CheckNameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final MixedRealityClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(MixedRealityClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MixedRealityClientResourceProviders to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MixedRealityClientRe") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}" + + "/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailabilityLocal( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckNameAvailabilityRequest checkNameAvailability, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Check Name Availability for local uniqueness. + * + * @param location The location in which uniqueness will be verified. + * @param checkNameAvailability Check Name Availability Request. + * @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 check Name Availability Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityLocalWithResponseAsync( + String location, CheckNameAvailabilityRequest checkNameAvailability) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (checkNameAvailability == null) { + return Mono + .error(new IllegalArgumentException("Parameter checkNameAvailability is required and cannot be null.")); + } else { + checkNameAvailability.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailabilityLocal( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + checkNameAvailability, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Check Name Availability for local uniqueness. + * + * @param location The location in which uniqueness will be verified. + * @param checkNameAvailability Check Name Availability Request. + * @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 check Name Availability Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityLocalWithResponseAsync( + String location, CheckNameAvailabilityRequest checkNameAvailability, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (checkNameAvailability == null) { + return Mono + .error(new IllegalArgumentException("Parameter checkNameAvailability is required and cannot be null.")); + } else { + checkNameAvailability.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailabilityLocal( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + checkNameAvailability, + accept, + context); + } + + /** + * Check Name Availability for local uniqueness. + * + * @param location The location in which uniqueness will be verified. + * @param checkNameAvailability Check Name Availability Request. + * @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 check Name Availability Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityLocalAsync( + String location, CheckNameAvailabilityRequest checkNameAvailability) { + return checkNameAvailabilityLocalWithResponseAsync(location, checkNameAvailability) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check Name Availability for local uniqueness. + * + * @param location The location in which uniqueness will be verified. + * @param checkNameAvailability Check Name Availability Request. + * @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 check Name Availability Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkNameAvailabilityLocal( + String location, CheckNameAvailabilityRequest checkNameAvailability) { + return checkNameAvailabilityLocalAsync(location, checkNameAvailability).block(); + } + + /** + * Check Name Availability for local uniqueness. + * + * @param location The location in which uniqueness will be verified. + * @param checkNameAvailability Check Name Availability Request. + * @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 check Name Availability Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityLocalWithResponse( + String location, CheckNameAvailabilityRequest checkNameAvailability, Context context) { + return checkNameAvailabilityLocalWithResponseAsync(location, checkNameAvailability, context).block(); + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/ResourceProvidersImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..527e407fbbc2f --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/ResourceProvidersImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mixedreality.MixedRealityManager; +import com.azure.resourcemanager.mixedreality.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.mixedreality.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mixedreality.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.mixedreality.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.mixedreality.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final MixedRealityManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, MixedRealityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CheckNameAvailabilityResponse checkNameAvailabilityLocal( + String location, CheckNameAvailabilityRequest checkNameAvailability) { + CheckNameAvailabilityResponseInner inner = + this.serviceClient().checkNameAvailabilityLocal(location, checkNameAvailability); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityLocalWithResponse( + String location, CheckNameAvailabilityRequest checkNameAvailability, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityLocalWithResponse(location, checkNameAvailability, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private MixedRealityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/SpatialAnchorsAccountImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/SpatialAnchorsAccountImpl.java new file mode 100644 index 0000000000000..23f8486d3273a --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/SpatialAnchorsAccountImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mixedreality.MixedRealityManager; +import com.azure.resourcemanager.mixedreality.fluent.models.SpatialAnchorsAccountInner; +import com.azure.resourcemanager.mixedreality.models.SpatialAnchorsAccount; +import java.util.Collections; +import java.util.Map; + +public final class SpatialAnchorsAccountImpl + implements SpatialAnchorsAccount, SpatialAnchorsAccount.Definition, SpatialAnchorsAccount.Update { + private SpatialAnchorsAccountInner innerObject; + + private final MixedRealityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String accountId() { + return this.innerModel().accountId(); + } + + public String accountDomain() { + return this.innerModel().accountDomain(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SpatialAnchorsAccountInner innerModel() { + return this.innerObject; + } + + private MixedRealityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + public SpatialAnchorsAccountImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SpatialAnchorsAccount create() { + this.innerObject = + serviceManager + .serviceClient() + .getSpatialAnchorsAccounts() + .createWithResponse(resourceGroupName, accountName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SpatialAnchorsAccount create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSpatialAnchorsAccounts() + .createWithResponse(resourceGroupName, accountName, this.innerModel(), context) + .getValue(); + return this; + } + + SpatialAnchorsAccountImpl(String name, MixedRealityManager serviceManager) { + this.innerObject = new SpatialAnchorsAccountInner(); + this.serviceManager = serviceManager; + this.accountName = name; + } + + public SpatialAnchorsAccountImpl update() { + return this; + } + + public SpatialAnchorsAccount apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSpatialAnchorsAccounts() + .updateWithResponse(resourceGroupName, accountName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SpatialAnchorsAccount apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSpatialAnchorsAccounts() + .updateWithResponse(resourceGroupName, accountName, this.innerModel(), context) + .getValue(); + return this; + } + + SpatialAnchorsAccountImpl(SpatialAnchorsAccountInner innerObject, MixedRealityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "spatialAnchorsAccounts"); + } + + public SpatialAnchorsAccount refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSpatialAnchorsAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public SpatialAnchorsAccount refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSpatialAnchorsAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public SpatialAnchorsAccountImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SpatialAnchorsAccountImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SpatialAnchorsAccountImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/SpatialAnchorsAccountsClientImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/SpatialAnchorsAccountsClientImpl.java new file mode 100644 index 0000000000000..a1b52d0bc5113 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/SpatialAnchorsAccountsClientImpl.java @@ -0,0 +1,1620 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mixedreality.fluent.SpatialAnchorsAccountsClient; +import com.azure.resourcemanager.mixedreality.fluent.models.AccountKeysInner; +import com.azure.resourcemanager.mixedreality.fluent.models.SpatialAnchorsAccountInner; +import com.azure.resourcemanager.mixedreality.models.AccountKeyRegenerateRequest; +import com.azure.resourcemanager.mixedreality.models.SpatialAnchorsAccountPage; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SpatialAnchorsAccountsClient. */ +public final class SpatialAnchorsAccountsClientImpl implements SpatialAnchorsAccountsClient { + private final ClientLogger logger = new ClientLogger(SpatialAnchorsAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SpatialAnchorsAccountsService service; + + /** The service client containing this operation class. */ + private final MixedRealityClientImpl client; + + /** + * Initializes an instance of SpatialAnchorsAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpatialAnchorsAccountsClientImpl(MixedRealityClientImpl client) { + this.service = + RestProxy + .create(SpatialAnchorsAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MixedRealityClientSpatialAnchorsAccounts to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MixedRealityClientSp") + private interface SpatialAnchorsAccountsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/spatialAnchorsAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/spatialAnchorsAccounts/{accountName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/spatialAnchorsAccounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/spatialAnchorsAccounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SpatialAnchorsAccountInner spatialAnchorsAccount, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/spatialAnchorsAccounts/{accountName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SpatialAnchorsAccountInner spatialAnchorsAccount, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/spatialAnchorsAccounts/{accountName}/listKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality" + + "/spatialAnchorsAccounts/{accountName}/regenerateKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> regenerateKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AccountKeyRegenerateRequest regenerate, + @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); + } + + /** + * List Spatial Anchors Accounts by 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 result of the request to get resource collection. + */ + @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 apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List Spatial Anchors Accounts by 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 result of the request to get resource collection. + */ + @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 apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Spatial Anchors Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Spatial Anchors Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List Spatial Anchors Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List Spatial Anchors Accounts by 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 result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @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 apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @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 apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Delete a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context); + } + + /** + * Delete a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName) { + return deleteWithResponseAsync(resourceGroupName, accountName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName) { + deleteAsync(resourceGroupName, accountName).block(); + } + + /** + * Delete a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String accountName, Context context) { + return deleteWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Retrieve a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieve a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context); + } + + /** + * Retrieve a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieve a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SpatialAnchorsAccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupAsync(resourceGroupName, accountName).block(); + } + + /** + * Retrieve a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account 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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String accountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (spatialAnchorsAccount == null) { + return Mono + .error(new IllegalArgumentException("Parameter spatialAnchorsAccount is required and cannot be null.")); + } else { + spatialAnchorsAccount.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + spatialAnchorsAccount, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account 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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String accountName, + SpatialAnchorsAccountInner spatialAnchorsAccount, + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (spatialAnchorsAccount == null) { + return Mono + .error(new IllegalArgumentException("Parameter spatialAnchorsAccount is required and cannot be null.")); + } else { + spatialAnchorsAccount.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + spatialAnchorsAccount, + accept, + context); + } + + /** + * Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account 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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { + return updateWithResponseAsync(resourceGroupName, accountName, spatialAnchorsAccount) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account 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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SpatialAnchorsAccountInner update( + String resourceGroupName, String accountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { + return updateAsync(resourceGroupName, accountName, spatialAnchorsAccount).block(); + } + + /** + * Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account 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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String accountName, + SpatialAnchorsAccountInner spatialAnchorsAccount, + Context context) { + return updateWithResponseAsync(resourceGroupName, accountName, spatialAnchorsAccount, context).block(); + } + + /** + * Creating or Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account 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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String accountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (spatialAnchorsAccount == null) { + return Mono + .error(new IllegalArgumentException("Parameter spatialAnchorsAccount is required and cannot be null.")); + } else { + spatialAnchorsAccount.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + spatialAnchorsAccount, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creating or Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account 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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String accountName, + SpatialAnchorsAccountInner spatialAnchorsAccount, + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (spatialAnchorsAccount == null) { + return Mono + .error(new IllegalArgumentException("Parameter spatialAnchorsAccount is required and cannot be null.")); + } else { + spatialAnchorsAccount.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + spatialAnchorsAccount, + accept, + context); + } + + /** + * Creating or Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account 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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String accountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { + return createWithResponseAsync(resourceGroupName, accountName, spatialAnchorsAccount) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creating or Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account 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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SpatialAnchorsAccountInner create( + String resourceGroupName, String accountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { + return createAsync(resourceGroupName, accountName, spatialAnchorsAccount).block(); + } + + /** + * Creating or Updating a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param spatialAnchorsAccount Spatial Anchors Account 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 spatialAnchorsAccount Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String accountName, + SpatialAnchorsAccountInner spatialAnchorsAccount, + Context context) { + return createWithResponseAsync(resourceGroupName, accountName, spatialAnchorsAccount, context).block(); + } + + /** + * List Both of the 2 Keys of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync(String resourceGroupName, String accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List Both of the 2 Keys of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync( + String resourceGroupName, String accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + accept, + context); + } + + /** + * List Both of the 2 Keys of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listKeysAsync(String resourceGroupName, String accountName) { + return listKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List Both of the 2 Keys of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountKeysInner listKeys(String resourceGroupName, String accountName) { + return listKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * List Both of the 2 Keys of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return listKeysWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Regenerate specified Key of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeysWithResponseAsync( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regenerate == null) { + return Mono.error(new IllegalArgumentException("Parameter regenerate is required and cannot be null.")); + } else { + regenerate.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .regenerateKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + regenerate, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Regenerate specified Key of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeysWithResponseAsync( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regenerate == null) { + return Mono.error(new IllegalArgumentException("Parameter regenerate is required and cannot be null.")); + } else { + regenerate.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .regenerateKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + apiVersion, + regenerate, + accept, + context); + } + + /** + * Regenerate specified Key of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeysAsync( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate) { + return regenerateKeysWithResponseAsync(resourceGroupName, accountName, regenerate) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate specified Key of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountKeysInner regenerateKeys( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate) { + return regenerateKeysAsync(resourceGroupName, accountName, regenerate).block(); + } + + /** + * Regenerate specified Key of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response regenerateKeysWithResponse( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate, Context context) { + return regenerateKeysWithResponseAsync(resourceGroupName, accountName, regenerate, context).block(); + } + + /** + * 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 result of the request to get resource collection. + */ + @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 result of the request to get resource collection. + */ + @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 result of the request to get resource collection. + */ + @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 result of the request to get resource collection. + */ + @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)); + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/SpatialAnchorsAccountsImpl.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/SpatialAnchorsAccountsImpl.java new file mode 100644 index 0000000000000..f9416a3b7b0c6 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/SpatialAnchorsAccountsImpl.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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.mixedreality.MixedRealityManager; +import com.azure.resourcemanager.mixedreality.fluent.SpatialAnchorsAccountsClient; +import com.azure.resourcemanager.mixedreality.fluent.models.AccountKeysInner; +import com.azure.resourcemanager.mixedreality.fluent.models.SpatialAnchorsAccountInner; +import com.azure.resourcemanager.mixedreality.models.AccountKeyRegenerateRequest; +import com.azure.resourcemanager.mixedreality.models.AccountKeys; +import com.azure.resourcemanager.mixedreality.models.SpatialAnchorsAccount; +import com.azure.resourcemanager.mixedreality.models.SpatialAnchorsAccounts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SpatialAnchorsAccountsImpl implements SpatialAnchorsAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SpatialAnchorsAccountsImpl.class); + + private final SpatialAnchorsAccountsClient innerClient; + + private final MixedRealityManager serviceManager; + + public SpatialAnchorsAccountsImpl(SpatialAnchorsAccountsClient innerClient, MixedRealityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new SpatialAnchorsAccountImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new SpatialAnchorsAccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new SpatialAnchorsAccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new SpatialAnchorsAccountImpl(inner1, this.manager())); + } + + public void deleteByResourceGroup(String resourceGroupName, String accountName) { + this.serviceClient().delete(resourceGroupName, accountName); + } + + public Response deleteWithResponse(String resourceGroupName, String accountName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, accountName, context); + } + + public SpatialAnchorsAccount getByResourceGroup(String resourceGroupName, String accountName) { + SpatialAnchorsAccountInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, accountName); + if (inner != null) { + return new SpatialAnchorsAccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SpatialAnchorsAccountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AccountKeys listKeys(String resourceGroupName, String accountName) { + AccountKeysInner inner = this.serviceClient().listKeys(resourceGroupName, accountName); + if (inner != null) { + return new AccountKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listKeysWithResponse(String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listKeysWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccountKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AccountKeys regenerateKeys( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate) { + AccountKeysInner inner = this.serviceClient().regenerateKeys(resourceGroupName, accountName, regenerate); + if (inner != null) { + return new AccountKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response regenerateKeysWithResponse( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate, Context context) { + Response inner = + this.serviceClient().regenerateKeysWithResponse(resourceGroupName, accountName, regenerate, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccountKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SpatialAnchorsAccount 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 accountName = Utils.getValueFromIdByName(id, "spatialAnchorsAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'spatialAnchorsAccounts'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, 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 accountName = Utils.getValueFromIdByName(id, "spatialAnchorsAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'spatialAnchorsAccounts'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, 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 accountName = Utils.getValueFromIdByName(id, "spatialAnchorsAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'spatialAnchorsAccounts'.", + id))); + } + this.deleteWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + public Response 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 accountName = Utils.getValueFromIdByName(id, "spatialAnchorsAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'spatialAnchorsAccounts'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, accountName, context); + } + + private SpatialAnchorsAccountsClient serviceClient() { + return this.innerClient; + } + + private MixedRealityManager manager() { + return this.serviceManager; + } + + public SpatialAnchorsAccountImpl define(String name) { + return new SpatialAnchorsAccountImpl(name, this.manager()); + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/Utils.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/Utils.java new file mode 100644 index 0000000000000..a24defdccd6e8 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/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.mixedreality.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/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/package-info.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/package-info.java new file mode 100644 index 0000000000000..83415761b2b2b --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for MixedRealityClient. Mixed Reality Client. */ +package com.azure.resourcemanager.mixedreality.implementation; diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/AccountKeyRegenerateRequest.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/AccountKeyRegenerateRequest.java new file mode 100644 index 0000000000000..6d7bcba560a6e --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/AccountKeyRegenerateRequest.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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; + +/** Request for account key regeneration. */ +@Fluent +public final class AccountKeyRegenerateRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountKeyRegenerateRequest.class); + + /* + * serial of key to be regenerated + */ + @JsonProperty(value = "serial") + private Serial serial; + + /** + * Get the serial property: serial of key to be regenerated. + * + * @return the serial value. + */ + public Serial serial() { + return this.serial; + } + + /** + * Set the serial property: serial of key to be regenerated. + * + * @param serial the serial value to set. + * @return the AccountKeyRegenerateRequest object itself. + */ + public AccountKeyRegenerateRequest withSerial(Serial serial) { + this.serial = serial; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/AccountKeys.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/AccountKeys.java new file mode 100644 index 0000000000000..9fa34bfbcd869 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/AccountKeys.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.mixedreality.models; + +import com.azure.resourcemanager.mixedreality.fluent.models.AccountKeysInner; + +/** An immutable client-side representation of AccountKeys. */ +public interface AccountKeys { + /** + * Gets the primaryKey property: value of primary key. + * + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * Gets the secondaryKey property: value of secondary key. + * + * @return the secondaryKey value. + */ + String secondaryKey(); + + /** + * Gets the inner com.azure.resourcemanager.mixedreality.fluent.models.AccountKeysInner object. + * + * @return the inner object. + */ + AccountKeysInner innerModel(); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/CheckNameAvailabilityRequest.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..7d218026030c4 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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; + +/** Check Name Availability Request. */ +@Fluent +public final class CheckNameAvailabilityRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityRequest.class); + + /* + * Resource Name To Verify + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Fully qualified resource type which includes provider namespace + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Get the name property: Resource Name To Verify. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Resource Name To Verify. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Fully qualified resource type which includes provider namespace. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Fully qualified resource type which includes provider namespace. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest 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 CheckNameAvailabilityRequest")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model CheckNameAvailabilityRequest")); + } + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/CheckNameAvailabilityResponse.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..f32ba0b16afc8 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/CheckNameAvailabilityResponse.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.mixedreality.models; + +import com.azure.resourcemanager.mixedreality.fluent.models.CheckNameAvailabilityResponseInner; + +/** An immutable client-side representation of CheckNameAvailabilityResponse. */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the nameAvailable property: if name Available. + * + * @return the nameAvailable value. + */ + NameAvailability nameAvailable(); + + /** + * Gets the reason property: Resource Name To Verify. + * + * @return the reason value. + */ + NameUnavailableReason reason(); + + /** + * Gets the message property: detail message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.mixedreality.fluent.models.CheckNameAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/Identity.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/Identity.java new file mode 100644 index 0000000000000..3c32b6c56d9e0 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/Identity.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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; + +/** Identity for the resource. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The identity type. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /** + * Get the principalId property: The principal ID of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/NameAvailability.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/NameAvailability.java new file mode 100644 index 0000000000000..c46abdc48848b --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/NameAvailability.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NameAvailability. */ +public final class NameAvailability extends ExpandableStringEnum { + /** Static value true for NameAvailability. */ + public static final NameAvailability TRUE = fromString("true"); + + /** Static value false for NameAvailability. */ + public static final NameAvailability FALSE = fromString("false"); + + /** + * Creates or finds a NameAvailability from its string representation. + * + * @param name a name to look for. + * @return the corresponding NameAvailability. + */ + @JsonCreator + public static NameAvailability fromString(String name) { + return fromString(name, NameAvailability.class); + } + + /** @return known NameAvailability values. */ + public static Collection values() { + return values(NameAvailability.class); + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/NameUnavailableReason.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/NameUnavailableReason.java new file mode 100644 index 0000000000000..35d2c44b2d07c --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/NameUnavailableReason.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NameUnavailableReason. */ +public final class NameUnavailableReason extends ExpandableStringEnum { + /** Static value Invalid for NameUnavailableReason. */ + public static final NameUnavailableReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for NameUnavailableReason. */ + public static final NameUnavailableReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a NameUnavailableReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding NameUnavailableReason. + */ + @JsonCreator + public static NameUnavailableReason fromString(String name) { + return fromString(name, NameUnavailableReason.class); + } + + /** @return known NameUnavailableReason values. */ + public static Collection values() { + return values(NameUnavailableReason.class); + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/Operation.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/Operation.java new file mode 100644 index 0000000000000..933759f1072ce --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/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.mixedreality.models; + +import com.azure.resourcemanager.mixedreality.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @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.mixedreality.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/OperationDisplay.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/OperationDisplay.java new file mode 100644 index 0000000000000..820d3a340529a --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/OperationDisplay.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft.ResourceProvider + */ + @JsonProperty(value = "provider", required = true) + private String provider; + + /* + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource", required = true) + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", required = true) + private String operation; + + /* + * Description of operation + */ + @JsonProperty(value = "description", required = true) + private String description; + + /** + * Get the provider property: Service provider: Microsoft.ResourceProvider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft.ResourceProvider. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation type: Read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type: Read, write, delete, etc. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provider() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property provider in model OperationDisplay")); + } + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property resource in model OperationDisplay")); + } + if (operation() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property operation in model OperationDisplay")); + } + if (description() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property description in model OperationDisplay")); + } + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/OperationPage.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/OperationPage.java new file mode 100644 index 0000000000000..3489cefc438d7 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/OperationPage.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.mixedreality.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mixedreality.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get + * the next set of results. + */ +@Fluent +public final class OperationPage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationPage.class); + + /* + * List of operations supported by the Resource Provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of operations supported by the Resource Provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the Resource Provider. + * + * @param value the value value to set. + * @return the OperationPage object itself. + */ + public OperationPage withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationPage object itself. + */ + public OperationPage withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/Operations.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/Operations.java new file mode 100644 index 0000000000000..93a1384b66235 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/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.mixedreality.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Exposing Available 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 result of the request to list Resource Provider operations. + */ + PagedIterable list(); + + /** + * Exposing Available 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 result of the request to list Resource Provider operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccount.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccount.java new file mode 100644 index 0000000000000..38c84f44a8718 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccount.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.mixedreality.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mixedreality.fluent.models.RemoteRenderingAccountInner; +import java.util.Map; + +/** An immutable client-side representation of RemoteRenderingAccount. */ +public interface RemoteRenderingAccount { + /** + * 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 identity property: Identity for the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the accountId property: unique id of certain account. + * + * @return the accountId value. + */ + String accountId(); + + /** + * Gets the accountDomain property: Correspond domain name of certain Spatial Anchors Account. + * + * @return the accountDomain value. + */ + String accountDomain(); + + /** + * 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.mixedreality.fluent.models.RemoteRenderingAccountInner object. + * + * @return the inner object. + */ + RemoteRenderingAccountInner innerModel(); + + /** The entirety of the RemoteRenderingAccount definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The RemoteRenderingAccount definition stages. */ + interface DefinitionStages { + /** The first stage of the RemoteRenderingAccount definition. */ + interface Blank extends WithLocation { + } + /** The stage of the RemoteRenderingAccount 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 RemoteRenderingAccount definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Name of an Azure resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the RemoteRenderingAccount 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.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + RemoteRenderingAccount create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + RemoteRenderingAccount create(Context context); + } + /** The stage of the RemoteRenderingAccount 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 RemoteRenderingAccount definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + } + /** + * Begins update for the RemoteRenderingAccount resource. + * + * @return the stage of resource update. + */ + RemoteRenderingAccount.Update update(); + + /** The template for RemoteRenderingAccount update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + RemoteRenderingAccount apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + RemoteRenderingAccount apply(Context context); + } + /** The RemoteRenderingAccount update stages. */ + interface UpdateStages { + /** The stage of the RemoteRenderingAccount update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the RemoteRenderingAccount update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(Identity identity); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + RemoteRenderingAccount refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + RemoteRenderingAccount refresh(Context context); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccountIdentity.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccountIdentity.java new file mode 100644 index 0000000000000..07cdcca8ffa8b --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccountIdentity.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The RemoteRenderingAccountIdentity model. */ +@Immutable +public class RemoteRenderingAccountIdentity extends Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemoteRenderingAccountIdentity.class); + + /** {@inheritDoc} */ + @Override + public RemoteRenderingAccountIdentity withType(ResourceIdentityType type) { + super.withType(type); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccountPage.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccountPage.java new file mode 100644 index 0000000000000..9efb74c5f0931 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccountPage.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.mixedreality.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mixedreality.fluent.models.RemoteRenderingAccountInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to get resource collection. It contains a list of resources and a URL link to get the next set + * of results. + */ +@Fluent +public final class RemoteRenderingAccountPage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemoteRenderingAccountPage.class); + + /* + * List of resources supported by the Resource Provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of resource list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of resources supported by the Resource Provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of resources supported by the Resource Provider. + * + * @param value the value value to set. + * @return the RemoteRenderingAccountPage object itself. + */ + public RemoteRenderingAccountPage withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of resource list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of resource list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the RemoteRenderingAccountPage object itself. + */ + public RemoteRenderingAccountPage withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccounts.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccounts.java new file mode 100644 index 0000000000000..ce8f5fb2f2b5f --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/RemoteRenderingAccounts.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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 RemoteRenderingAccounts. */ +public interface RemoteRenderingAccounts { + /** + * List Remote Rendering Accounts by 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 result of the request to get resource collection. + */ + PagedIterable list(); + + /** + * List Remote Rendering Accounts by 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 result of the request to get resource collection. + */ + PagedIterable list(Context context); + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Delete a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName); + + /** + * Delete a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 response. + */ + Response deleteWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Retrieve a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 remoteRenderingAccount Response. + */ + RemoteRenderingAccount getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Retrieve a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 remoteRenderingAccount Response. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * List Both of the 2 Keys of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + AccountKeys listKeys(String resourceGroupName, String accountName); + + /** + * List Both of the 2 Keys of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + Response listKeysWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Regenerate specified Key of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + AccountKeys regenerateKeys(String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate); + + /** + * Regenerate specified Key of a Remote Rendering Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + Response regenerateKeysWithResponse( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate, Context context); + + /** + * Retrieve a Remote Rendering Account. + * + * @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 remoteRenderingAccount Response. + */ + RemoteRenderingAccount getById(String id); + + /** + * Retrieve a Remote Rendering Account. + * + * @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 remoteRenderingAccount Response. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Remote Rendering Account. + * + * @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 a Remote Rendering Account. + * + * @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 response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new RemoteRenderingAccount resource. + * + * @param name resource name. + * @return the first stage of the new RemoteRenderingAccount definition. + */ + RemoteRenderingAccount.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/ResourceIdentityType.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..4ff16291642ef --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/ResourceIdentityType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/ResourceProviders.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/ResourceProviders.java new file mode 100644 index 0000000000000..5f1732f1bb50d --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/ResourceProviders.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.mixedreality.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Check Name Availability for local uniqueness. + * + * @param location The location in which uniqueness will be verified. + * @param checkNameAvailability Check Name Availability Request. + * @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 check Name Availability Response. + */ + CheckNameAvailabilityResponse checkNameAvailabilityLocal( + String location, CheckNameAvailabilityRequest checkNameAvailability); + + /** + * Check Name Availability for local uniqueness. + * + * @param location The location in which uniqueness will be verified. + * @param checkNameAvailability Check Name Availability Request. + * @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 check Name Availability Response. + */ + Response checkNameAvailabilityLocalWithResponse( + String location, CheckNameAvailabilityRequest checkNameAvailability, Context context); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/Serial.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/Serial.java new file mode 100644 index 0000000000000..562f89ff8b841 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/Serial.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for Serial. */ +public enum Serial { + /** Enum value 1. */ + ONE(1), + + /** Enum value 2. */ + TWO(2); + + /** The actual serialized value for a Serial instance. */ + private final int value; + + Serial(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a Serial instance. + * + * @param value the serialized value to parse. + * @return the parsed Serial object, or null if unable to parse. + */ + @JsonCreator + public static Serial fromInt(int value) { + Serial[] items = Serial.values(); + for (Serial item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + @JsonValue + public int toInt() { + return this.value; + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/SpatialAnchorsAccount.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/SpatialAnchorsAccount.java new file mode 100644 index 0000000000000..d7cd1d8d72bda --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/SpatialAnchorsAccount.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mixedreality.fluent.models.SpatialAnchorsAccountInner; +import java.util.Map; + +/** An immutable client-side representation of SpatialAnchorsAccount. */ +public interface SpatialAnchorsAccount { + /** + * 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 accountId property: unique id of certain account. + * + * @return the accountId value. + */ + String accountId(); + + /** + * Gets the accountDomain property: Correspond domain name of certain Spatial Anchors Account. + * + * @return the accountDomain value. + */ + String accountDomain(); + + /** + * 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.mixedreality.fluent.models.SpatialAnchorsAccountInner object. + * + * @return the inner object. + */ + SpatialAnchorsAccountInner innerModel(); + + /** The entirety of the SpatialAnchorsAccount definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The SpatialAnchorsAccount definition stages. */ + interface DefinitionStages { + /** The first stage of the SpatialAnchorsAccount definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SpatialAnchorsAccount 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 SpatialAnchorsAccount definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Name of an Azure resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the SpatialAnchorsAccount 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + SpatialAnchorsAccount create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SpatialAnchorsAccount create(Context context); + } + /** The stage of the SpatialAnchorsAccount 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); + } + } + /** + * Begins update for the SpatialAnchorsAccount resource. + * + * @return the stage of resource update. + */ + SpatialAnchorsAccount.Update update(); + + /** The template for SpatialAnchorsAccount update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SpatialAnchorsAccount apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SpatialAnchorsAccount apply(Context context); + } + /** The SpatialAnchorsAccount update stages. */ + interface UpdateStages { + /** The stage of the SpatialAnchorsAccount update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SpatialAnchorsAccount refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SpatialAnchorsAccount refresh(Context context); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/SpatialAnchorsAccountPage.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/SpatialAnchorsAccountPage.java new file mode 100644 index 0000000000000..1cf655633112c --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/SpatialAnchorsAccountPage.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.mixedreality.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mixedreality.fluent.models.SpatialAnchorsAccountInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to get resource collection. It contains a list of resources and a URL link to get the next set + * of results. + */ +@Fluent +public final class SpatialAnchorsAccountPage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SpatialAnchorsAccountPage.class); + + /* + * List of resources supported by the Resource Provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of resource list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of resources supported by the Resource Provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of resources supported by the Resource Provider. + * + * @param value the value value to set. + * @return the SpatialAnchorsAccountPage object itself. + */ + public SpatialAnchorsAccountPage withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of resource list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of resource list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the SpatialAnchorsAccountPage object itself. + */ + public SpatialAnchorsAccountPage withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/SpatialAnchorsAccounts.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/SpatialAnchorsAccounts.java new file mode 100644 index 0000000000000..2d79e5ddacc93 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/SpatialAnchorsAccounts.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mixedreality.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 SpatialAnchorsAccounts. */ +public interface SpatialAnchorsAccounts { + /** + * List Spatial Anchors Accounts by 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 result of the request to get resource collection. + */ + PagedIterable list(); + + /** + * List Spatial Anchors Accounts by 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 result of the request to get resource collection. + */ + PagedIterable list(Context context); + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Resources by Resource Group. + * + * @param resourceGroupName Name of an Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to get resource collection. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Delete a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 accountName); + + /** + * Delete a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 response. + */ + Response deleteWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Retrieve a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 spatialAnchorsAccount Response. + */ + SpatialAnchorsAccount getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Retrieve a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 spatialAnchorsAccount Response. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * List Both of the 2 Keys of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + AccountKeys listKeys(String resourceGroupName, String accountName); + + /** + * List Both of the 2 Keys of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @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 developer Keys of account. + */ + Response listKeysWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Regenerate specified Key of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + AccountKeys regenerateKeys(String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate); + + /** + * Regenerate specified Key of a Spatial Anchors Account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Name of an Mixed Reality Account. + * @param regenerate Required information for key regeneration. + * @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 developer Keys of account. + */ + Response regenerateKeysWithResponse( + String resourceGroupName, String accountName, AccountKeyRegenerateRequest regenerate, Context context); + + /** + * Retrieve a Spatial Anchors Account. + * + * @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 spatialAnchorsAccount Response. + */ + SpatialAnchorsAccount getById(String id); + + /** + * Retrieve a Spatial Anchors Account. + * + * @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 spatialAnchorsAccount Response. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Spatial Anchors Account. + * + * @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 a Spatial Anchors Account. + * + * @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 response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SpatialAnchorsAccount resource. + * + * @param name resource name. + * @return the first stage of the new SpatialAnchorsAccount definition. + */ + SpatialAnchorsAccount.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/package-info.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/package-info.java new file mode 100644 index 0000000000000..824b0239b8e26 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for MixedRealityClient. Mixed Reality Client. */ +package com.azure.resourcemanager.mixedreality.models; diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/package-info.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/package-info.java new file mode 100644 index 0000000000000..73c1f1e13f844 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/com/azure/resourcemanager/mixedreality/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for MixedRealityClient. Mixed Reality Client. */ +package com.azure.resourcemanager.mixedreality; diff --git a/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/module-info.java b/sdk/mixedreality/azure-resourcemanager-mixedreality/src/main/java/module-info.java new file mode 100644 index 0000000000000..4dc4743102294 --- /dev/null +++ b/sdk/mixedreality/azure-resourcemanager-mixedreality/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.mixedreality { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.mixedreality; + exports com.azure.resourcemanager.mixedreality.fluent; + exports com.azure.resourcemanager.mixedreality.fluent.models; + exports com.azure.resourcemanager.mixedreality.models; + + opens com.azure.resourcemanager.mixedreality.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.mixedreality.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/mixedreality/ci.yml b/sdk/mixedreality/ci.yml new file mode 100644 index 0000000000000..9faff16487fd2 --- /dev/null +++ b/sdk/mixedreality/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/mixedreality/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mixedreality/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: mixedreality + Artifacts: + - name: azure-resourcemanager-mixedreality + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermixedreality diff --git a/sdk/mixedreality/pom.xml b/sdk/mixedreality/pom.xml new file mode 100644 index 0000000000000..674c7c3dc4bd3 --- /dev/null +++ b/sdk/mixedreality/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-mixedreality-service + pom + 1.0.0 + + azure-resourcemanager-mixedreality + +