diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 0dfd480ea389..ae800c103f37 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -315,6 +315,7 @@ com.azure.resourcemanager:azure-resourcemanager-azurearcdata;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-hybridnetwork;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-purview;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-mysqlflexibleserver;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-extendedlocation;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index 0494b3116ae7..3cac0b5bb8a1 100644 --- a/pom.xml +++ b/pom.xml @@ -760,6 +760,7 @@ sdk/elastic sdk/eventgrid sdk/eventhubs + sdk/extendedlocation sdk/formrecognizer sdk/frontdoor sdk/hanaonazure diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/CHANGELOG.md b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/CHANGELOG.md new file mode 100644 index 000000000000..7a2051c72a3f --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-09-10) + +- Azure Resource Manager CustomLocations client library for Java. This package contains Microsoft Azure SDK for CustomLocations Management SDK. The customLocations Rest API spec. Package tag package-2021-08-15. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/README.md b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/README.md new file mode 100644 index 000000000000..41a8f25c413b --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/README.md @@ -0,0 +1,101 @@ +# Azure Resource Manager CustomLocations client library for Java + +Azure Resource Manager CustomLocations client library for Java. + +This package contains Microsoft Azure SDK for CustomLocations Management SDK. The customLocations Rest API spec. Package tag package-2021-08-15. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-extendedlocation;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-extendedlocation + 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(); +CustomLocationsManager manager = CustomLocationsManager + .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/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/pom.xml b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/pom.xml new file mode 100644 index 000000000000..1e42dbd46721 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-extendedlocation + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for CustomLocations Management + This package contains Microsoft Azure SDK for CustomLocations Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The customLocations Rest API spec. Package tag package-2021-08-15. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.20.0 + + + com.azure + azure-core-management + 1.4.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/CustomLocationsManager.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/CustomLocationsManager.java new file mode 100644 index 000000000000..dd1f9e16aa11 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/CustomLocationsManager.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation; + +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.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.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.extendedlocation.fluent.CustomLocationsManagementClient; +import com.azure.resourcemanager.extendedlocation.implementation.CustomLocationsImpl; +import com.azure.resourcemanager.extendedlocation.implementation.CustomLocationsManagementClientBuilder; +import com.azure.resourcemanager.extendedlocation.models.CustomLocations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to CustomLocationsManager. The customLocations Rest API spec. */ +public final class CustomLocationsManager { + private CustomLocations customLocations; + + private final CustomLocationsManagementClient clientObject; + + private CustomLocationsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new CustomLocationsManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of CustomLocations service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CustomLocations service API instance. + */ + public static CustomLocationsManager 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 CustomLocationsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CustomLocationsManager.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 final List scopes = 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; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' 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 CustomLocations service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CustomLocations service API instance. + */ + public CustomLocationsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.extendedlocation") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new CustomLocationsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of CustomLocations. */ + public CustomLocations customLocations() { + if (this.customLocations == null) { + this.customLocations = new CustomLocationsImpl(clientObject.getCustomLocations(), this); + } + return customLocations; + } + + /** + * @return Wrapped service client CustomLocationsManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public CustomLocationsManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/CustomLocationsClient.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/CustomLocationsClient.java new file mode 100644 index 000000000000..25036a4298f6 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/CustomLocationsClient.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationInner; +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationOperationInner; +import com.azure.resourcemanager.extendedlocation.fluent.models.EnabledResourceTypeInner; +import com.azure.resourcemanager.extendedlocation.models.PatchableCustomLocations; + +/** An instance of this class provides access to all the operations defined in CustomLocationsClient. */ +public interface CustomLocationsClient { + /** + * Lists all available Custom Locations 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 lists of Custom Locations operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(); + + /** + * Lists all available Custom Locations 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 lists of Custom Locations operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(Context context); + + /** + * Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom + * Location. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom + * Location. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of Custom Locations in the specified subscription and resource group. The operation returns + * properties of each Custom Location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of Custom Locations in the specified subscription and resource group. The operation returns + * properties of each Custom Location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 details of the customLocation with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomLocationInner getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 details of the customLocation with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CustomLocationInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, CustomLocationInner parameters); + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CustomLocationInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, CustomLocationInner parameters, Context context); + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomLocationInner createOrUpdate(String resourceGroupName, String resourceName, CustomLocationInner parameters); + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomLocationInner createOrUpdate( + String resourceGroupName, String resourceName, CustomLocationInner parameters, Context context); + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName); + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName, Context context); + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceName); + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceName, Context context); + + /** + * Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters The updatable fields of an existing Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomLocationInner update(String resourceGroupName, String resourceName, PatchableCustomLocations parameters); + + /** + * Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters The updatable fields of an existing Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String resourceName, PatchableCustomLocations parameters, Context context); + + /** + * Gets the list of the Enabled Resource Types. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 list of the Enabled Resource Types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listEnabledResourceTypes(String resourceGroupName, String resourceName); + + /** + * Gets the list of the Enabled Resource Types. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 list of the Enabled Resource Types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listEnabledResourceTypes( + String resourceGroupName, String resourceName, Context context); +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/CustomLocationsManagementClient.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/CustomLocationsManagementClient.java new file mode 100644 index 000000000000..fe9be079d8ad --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/CustomLocationsManagementClient.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for CustomLocationsManagementClient class. */ +public interface CustomLocationsManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the CustomLocationsClient object to access its operations. + * + * @return the CustomLocationsClient object. + */ + CustomLocationsClient getCustomLocations(); +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/CustomLocationInner.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/CustomLocationInner.java new file mode 100644 index 000000000000..0606e04934b1 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/CustomLocationInner.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.extendedlocation.models.CustomLocationPropertiesAuthentication; +import com.azure.resourcemanager.extendedlocation.models.HostType; +import com.azure.resourcemanager.extendedlocation.models.Identity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Custom Locations definition. */ +@JsonFlatten +@Fluent +public class CustomLocationInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationInner.class); + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * Metadata pertaining to creation and last modification of the resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * This is optional input that contains the authentication that should be + * used to generate the namespace. + */ + @JsonProperty(value = "properties.authentication") + private CustomLocationPropertiesAuthentication authentication; + + /* + * Contains the reference to the add-on that contains charts to deploy CRDs + * and operators. + */ + @JsonProperty(value = "properties.clusterExtensionIds") + private List clusterExtensionIds; + + /* + * Display name for the Custom Locations location. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * Connected Cluster or AKS Cluster. The Custom Locations RP will perform a + * checkAccess API for listAdminCredentials permissions. + */ + @JsonProperty(value = "properties.hostResourceId") + private String hostResourceId; + + /* + * Type of host the Custom Locations is referencing (Kubernetes, etc...). + */ + @JsonProperty(value = "properties.hostType") + private HostType hostType; + + /* + * Kubernetes namespace that will be created on the specified cluster. + */ + @JsonProperty(value = "properties.namespace") + private String namespace; + + /* + * Provisioning State for the Custom Location. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * 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 CustomLocationInner object itself. + */ + public CustomLocationInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the authentication property: This is optional input that contains the authentication that should be used to + * generate the namespace. + * + * @return the authentication value. + */ + public CustomLocationPropertiesAuthentication authentication() { + return this.authentication; + } + + /** + * Set the authentication property: This is optional input that contains the authentication that should be used to + * generate the namespace. + * + * @param authentication the authentication value to set. + * @return the CustomLocationInner object itself. + */ + public CustomLocationInner withAuthentication(CustomLocationPropertiesAuthentication authentication) { + this.authentication = authentication; + return this; + } + + /** + * Get the clusterExtensionIds property: Contains the reference to the add-on that contains charts to deploy CRDs + * and operators. + * + * @return the clusterExtensionIds value. + */ + public List clusterExtensionIds() { + return this.clusterExtensionIds; + } + + /** + * Set the clusterExtensionIds property: Contains the reference to the add-on that contains charts to deploy CRDs + * and operators. + * + * @param clusterExtensionIds the clusterExtensionIds value to set. + * @return the CustomLocationInner object itself. + */ + public CustomLocationInner withClusterExtensionIds(List clusterExtensionIds) { + this.clusterExtensionIds = clusterExtensionIds; + return this; + } + + /** + * Get the displayName property: Display name for the Custom Locations location. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name for the Custom Locations location. + * + * @param displayName the displayName value to set. + * @return the CustomLocationInner object itself. + */ + public CustomLocationInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the hostResourceId property: Connected Cluster or AKS Cluster. The Custom Locations RP will perform a + * checkAccess API for listAdminCredentials permissions. + * + * @return the hostResourceId value. + */ + public String hostResourceId() { + return this.hostResourceId; + } + + /** + * Set the hostResourceId property: Connected Cluster or AKS Cluster. The Custom Locations RP will perform a + * checkAccess API for listAdminCredentials permissions. + * + * @param hostResourceId the hostResourceId value to set. + * @return the CustomLocationInner object itself. + */ + public CustomLocationInner withHostResourceId(String hostResourceId) { + this.hostResourceId = hostResourceId; + return this; + } + + /** + * Get the hostType property: Type of host the Custom Locations is referencing (Kubernetes, etc...). + * + * @return the hostType value. + */ + public HostType hostType() { + return this.hostType; + } + + /** + * Set the hostType property: Type of host the Custom Locations is referencing (Kubernetes, etc...). + * + * @param hostType the hostType value to set. + * @return the CustomLocationInner object itself. + */ + public CustomLocationInner withHostType(HostType hostType) { + this.hostType = hostType; + return this; + } + + /** + * Get the namespace property: Kubernetes namespace that will be created on the specified cluster. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: Kubernetes namespace that will be created on the specified cluster. + * + * @param namespace the namespace value to set. + * @return the CustomLocationInner object itself. + */ + public CustomLocationInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the provisioningState property: Provisioning State for the Custom Location. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provisioning State for the Custom Location. + * + * @param provisioningState the provisioningState value to set. + * @return the CustomLocationInner object itself. + */ + public CustomLocationInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** {@inheritDoc} */ + @Override + public CustomLocationInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CustomLocationInner 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(); + } + if (authentication() != null) { + authentication().validate(); + } + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/CustomLocationOperationInner.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/CustomLocationOperationInner.java new file mode 100644 index 000000000000..fff10c247c44 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/CustomLocationOperationInner.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Custom Locations operation. */ +@JsonFlatten +@Immutable +public class CustomLocationOperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationOperationInner.class); + + /* + * Is this Operation a data plane operation + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * The name of the compute operation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The origin of the compute operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /* + * The description of the operation. + */ + @JsonProperty(value = "display.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The display name of the compute operation. + */ + @JsonProperty(value = "display.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The resource provider for the operation. + */ + @JsonProperty(value = "display.provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The display name of the resource the operation applies to. + */ + @JsonProperty(value = "display.resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Get the isDataAction property: Is this Operation a data plane operation. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the name property: The name of the compute operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the origin property: The origin of the compute operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/EnabledResourceTypeInner.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/EnabledResourceTypeInner.java new file mode 100644 index 000000000000..973f23a62888 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/EnabledResourceTypeInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.extendedlocation.models.EnabledResourceTypePropertiesTypesMetadataItem; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** EnabledResourceType definition. */ +@JsonFlatten +@Fluent +public class EnabledResourceTypeInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnabledResourceTypeInner.class); + + /* + * Metadata pertaining to creation and last modification of the resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Cluster Extension ID + */ + @JsonProperty(value = "properties.clusterExtensionId") + private String clusterExtensionId; + + /* + * Cluster Extension Type + */ + @JsonProperty(value = "properties.extensionType") + private String extensionType; + + /* + * Metadata of the Resource Type + */ + @JsonProperty(value = "properties.typesMetadata") + private List typesMetadata; + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the clusterExtensionId property: Cluster Extension ID. + * + * @return the clusterExtensionId value. + */ + public String clusterExtensionId() { + return this.clusterExtensionId; + } + + /** + * Set the clusterExtensionId property: Cluster Extension ID. + * + * @param clusterExtensionId the clusterExtensionId value to set. + * @return the EnabledResourceTypeInner object itself. + */ + public EnabledResourceTypeInner withClusterExtensionId(String clusterExtensionId) { + this.clusterExtensionId = clusterExtensionId; + return this; + } + + /** + * Get the extensionType property: Cluster Extension Type. + * + * @return the extensionType value. + */ + public String extensionType() { + return this.extensionType; + } + + /** + * Set the extensionType property: Cluster Extension Type. + * + * @param extensionType the extensionType value to set. + * @return the EnabledResourceTypeInner object itself. + */ + public EnabledResourceTypeInner withExtensionType(String extensionType) { + this.extensionType = extensionType; + return this; + } + + /** + * Get the typesMetadata property: Metadata of the Resource Type. + * + * @return the typesMetadata value. + */ + public List typesMetadata() { + return this.typesMetadata; + } + + /** + * Set the typesMetadata property: Metadata of the Resource Type. + * + * @param typesMetadata the typesMetadata value to set. + * @return the EnabledResourceTypeInner object itself. + */ + public EnabledResourceTypeInner withTypesMetadata( + List typesMetadata) { + this.typesMetadata = typesMetadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (typesMetadata() != null) { + typesMetadata().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/package-info.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/models/package-info.java new file mode 100644 index 000000000000..034425cac582 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/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 CustomLocationsManagementClient. The customLocations Rest API spec. */ +package com.azure.resourcemanager.extendedlocation.fluent.models; diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/package-info.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/fluent/package-info.java new file mode 100644 index 000000000000..01649d46082c --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/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 CustomLocationsManagementClient. The customLocations Rest API spec. */ +package com.azure.resourcemanager.extendedlocation.fluent; diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationImpl.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationImpl.java new file mode 100644 index 000000000000..1450cdfa7b31 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationImpl.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationInner; +import com.azure.resourcemanager.extendedlocation.models.CustomLocation; +import com.azure.resourcemanager.extendedlocation.models.CustomLocationPropertiesAuthentication; +import com.azure.resourcemanager.extendedlocation.models.HostType; +import com.azure.resourcemanager.extendedlocation.models.Identity; +import com.azure.resourcemanager.extendedlocation.models.PatchableCustomLocations; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CustomLocationImpl implements CustomLocation, CustomLocation.Definition, CustomLocation.Update { + private CustomLocationInner innerObject; + + private final com.azure.resourcemanager.extendedlocation.CustomLocationsManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public CustomLocationPropertiesAuthentication authentication() { + return this.innerModel().authentication(); + } + + public List clusterExtensionIds() { + List inner = this.innerModel().clusterExtensionIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String hostResourceId() { + return this.innerModel().hostResourceId(); + } + + public HostType hostType() { + return this.innerModel().hostType(); + } + + public String namespace() { + return this.innerModel().namespace(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CustomLocationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.extendedlocation.CustomLocationsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private PatchableCustomLocations updateParameters; + + public CustomLocationImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CustomLocation create() { + this.innerObject = + serviceManager + .serviceClient() + .getCustomLocations() + .createOrUpdate(resourceGroupName, resourceName, this.innerModel(), Context.NONE); + return this; + } + + public CustomLocation create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCustomLocations() + .createOrUpdate(resourceGroupName, resourceName, this.innerModel(), context); + return this; + } + + CustomLocationImpl(String name, com.azure.resourcemanager.extendedlocation.CustomLocationsManager serviceManager) { + this.innerObject = new CustomLocationInner(); + this.serviceManager = serviceManager; + this.resourceName = name; + } + + public CustomLocationImpl update() { + this.updateParameters = new PatchableCustomLocations(); + return this; + } + + public CustomLocation apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCustomLocations() + .updateWithResponse(resourceGroupName, resourceName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public CustomLocation apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCustomLocations() + .updateWithResponse(resourceGroupName, resourceName, updateParameters, context) + .getValue(); + return this; + } + + CustomLocationImpl( + CustomLocationInner innerObject, + com.azure.resourcemanager.extendedlocation.CustomLocationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "customLocations"); + } + + public CustomLocation refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCustomLocations() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE) + .getValue(); + return this; + } + + public CustomLocation refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCustomLocations() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, context) + .getValue(); + return this; + } + + public CustomLocationImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CustomLocationImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CustomLocationImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public CustomLocationImpl withIdentity(Identity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public CustomLocationImpl withAuthentication(CustomLocationPropertiesAuthentication authentication) { + if (isInCreateMode()) { + this.innerModel().withAuthentication(authentication); + return this; + } else { + this.updateParameters.withAuthentication(authentication); + return this; + } + } + + public CustomLocationImpl withClusterExtensionIds(List clusterExtensionIds) { + if (isInCreateMode()) { + this.innerModel().withClusterExtensionIds(clusterExtensionIds); + return this; + } else { + this.updateParameters.withClusterExtensionIds(clusterExtensionIds); + return this; + } + } + + public CustomLocationImpl withDisplayName(String displayName) { + if (isInCreateMode()) { + this.innerModel().withDisplayName(displayName); + return this; + } else { + this.updateParameters.withDisplayName(displayName); + return this; + } + } + + public CustomLocationImpl withHostResourceId(String hostResourceId) { + if (isInCreateMode()) { + this.innerModel().withHostResourceId(hostResourceId); + return this; + } else { + this.updateParameters.withHostResourceId(hostResourceId); + return this; + } + } + + public CustomLocationImpl withHostType(HostType hostType) { + if (isInCreateMode()) { + this.innerModel().withHostType(hostType); + return this; + } else { + this.updateParameters.withHostType(hostType); + return this; + } + } + + public CustomLocationImpl withNamespace(String namespace) { + if (isInCreateMode()) { + this.innerModel().withNamespace(namespace); + return this; + } else { + this.updateParameters.withNamespace(namespace); + return this; + } + } + + public CustomLocationImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } else { + this.updateParameters.withProvisioningState(provisioningState); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationOperationImpl.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationOperationImpl.java new file mode 100644 index 000000000000..f4413838b36c --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationOperationImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.implementation; + +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationOperationInner; +import com.azure.resourcemanager.extendedlocation.models.CustomLocationOperation; + +public final class CustomLocationOperationImpl implements CustomLocationOperation { + private CustomLocationOperationInner innerObject; + + private final com.azure.resourcemanager.extendedlocation.CustomLocationsManager serviceManager; + + CustomLocationOperationImpl( + CustomLocationOperationInner innerObject, + com.azure.resourcemanager.extendedlocation.CustomLocationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public String name() { + return this.innerModel().name(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public String description() { + return this.innerModel().description(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String provider() { + return this.innerModel().provider(); + } + + public String resource() { + return this.innerModel().resource(); + } + + public CustomLocationOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.extendedlocation.CustomLocationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsClientImpl.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsClientImpl.java new file mode 100644 index 000000000000..da27ca9a7b67 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsClientImpl.java @@ -0,0 +1,1946 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.extendedlocation.fluent.CustomLocationsClient; +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationInner; +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationOperationInner; +import com.azure.resourcemanager.extendedlocation.fluent.models.EnabledResourceTypeInner; +import com.azure.resourcemanager.extendedlocation.models.CustomLocationListResult; +import com.azure.resourcemanager.extendedlocation.models.CustomLocationOperationsList; +import com.azure.resourcemanager.extendedlocation.models.EnabledResourceTypesListResult; +import com.azure.resourcemanager.extendedlocation.models.PatchableCustomLocations; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CustomLocationsClient. */ +public final class CustomLocationsClientImpl implements CustomLocationsClient { + private final ClientLogger logger = new ClientLogger(CustomLocationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CustomLocationsService service; + + /** The service client containing this operation class. */ + private final CustomLocationsManagementClientImpl client; + + /** + * Initializes an instance of CustomLocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CustomLocationsClientImpl(CustomLocationsManagementClientImpl client) { + this.service = + RestProxy.create(CustomLocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CustomLocationsManagementClientCustomLocations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CustomLocationsManag") + private interface CustomLocationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ExtendedLocation/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOperations( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ExtendedLocation/customLocations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation" + + "/customLocations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation" + + "/customLocations/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation" + + "/customLocations/{resourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") CustomLocationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation" + + "/customLocations/{resourceName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation" + + "/customLocations/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") PatchableCustomLocations parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation" + + "/customLocations/{resourceName}/enabledResourceTypes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listEnabledResourceTypes( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOperationsNext( + @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> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listEnabledResourceTypesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all available Custom Locations 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 lists of Custom Locations operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsSinglePageAsync() { + 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.listOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all available Custom Locations 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 lists of Custom Locations operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all available Custom Locations 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 lists of Custom Locations operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync() { + return new PagedFlux<>( + () -> listOperationsSinglePageAsync(), nextLink -> listOperationsNextSinglePageAsync(nextLink)); + } + + /** + * Lists all available Custom Locations 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 lists of Custom Locations operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync(Context context) { + return new PagedFlux<>( + () -> listOperationsSinglePageAsync(context), + nextLink -> listOperationsNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all available Custom Locations 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 lists of Custom Locations operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations() { + return new PagedIterable<>(listOperationsAsync()); + } + + /** + * Lists all available Custom Locations 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 lists of Custom Locations operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations(Context context) { + return new PagedIterable<>(listOperationsAsync(context)); + } + + /** + * Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom + * Location. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom + * Location. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom + * Location. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom + * Location. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom + * Location. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom + * Location. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list of Custom Locations in the specified subscription and resource group. The operation returns + * properties of each Custom Location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of Custom Locations in the specified subscription and resource group. The operation returns + * properties of each Custom Location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of Custom Locations in the specified subscription and resource group. The operation returns + * properties of each Custom Location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Custom Locations in the specified subscription and resource group. The operation returns + * properties of each Custom Location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of Custom Locations in the specified subscription and resource group. The operation returns + * properties of each Custom Location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of Custom Locations in the specified subscription and resource group. The operation returns + * properties of each Custom Location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 details of the customLocation with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 details of the customLocation with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 details of the customLocation with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 details of the customLocation with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomLocationInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupAsync(resourceGroupName, resourceName).block(); + } + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 details of the customLocation with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, CustomLocationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, CustomLocationInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + parameters, + accept, + context); + } + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CustomLocationInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, CustomLocationInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CustomLocationInner.class, + CustomLocationInner.class, + Context.NONE); + } + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CustomLocationInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, CustomLocationInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CustomLocationInner.class, CustomLocationInner.class, context); + } + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CustomLocationInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, CustomLocationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CustomLocationInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, CustomLocationInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, CustomLocationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, CustomLocationInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomLocationInner createOrUpdate( + String resourceGroupName, String resourceName, CustomLocationInner parameters) { + return createOrUpdateAsync(resourceGroupName, resourceName, parameters).block(); + } + + /** + * Creates or updates a Custom Location in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters Parameters supplied to create or update a Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomLocationInner createOrUpdate( + String resourceGroupName, String resourceName, CustomLocationInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, resourceName, parameters, context).block(); + } + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String resourceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String resourceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceName).getSyncPoller(); + } + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context).getSyncPoller(); + } + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName) { + deleteAsync(resourceGroupName, resourceName).block(); + } + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName, Context context) { + deleteAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters The updatable fields of an existing Custom Location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceName, PatchableCustomLocations parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters The updatable fields of an existing Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceName, PatchableCustomLocations parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + parameters, + accept, + context); + } + + /** + * Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters The updatable fields of an existing Custom Location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, PatchableCustomLocations parameters) { + return updateWithResponseAsync(resourceGroupName, resourceName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters The updatable fields of an existing Custom Location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomLocationInner update( + String resourceGroupName, String resourceName, PatchableCustomLocations parameters) { + return updateAsync(resourceGroupName, resourceName, parameters).block(); + } + + /** + * Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param parameters The updatable fields of an existing Custom Location. + * @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 custom Locations definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String resourceName, PatchableCustomLocations parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, resourceName, parameters, context).block(); + } + + /** + * Gets the list of the Enabled Resource Types. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 list of the Enabled Resource Types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listEnabledResourceTypesSinglePageAsync( + String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listEnabledResourceTypes( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of the Enabled Resource Types. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 list of the Enabled Resource Types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listEnabledResourceTypesSinglePageAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listEnabledResourceTypes( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of the Enabled Resource Types. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 list of the Enabled Resource Types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listEnabledResourceTypesAsync( + String resourceGroupName, String resourceName) { + return new PagedFlux<>( + () -> listEnabledResourceTypesSinglePageAsync(resourceGroupName, resourceName), + nextLink -> listEnabledResourceTypesNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of the Enabled Resource Types. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 list of the Enabled Resource Types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listEnabledResourceTypesAsync( + String resourceGroupName, String resourceName, Context context) { + return new PagedFlux<>( + () -> listEnabledResourceTypesSinglePageAsync(resourceGroupName, resourceName, context), + nextLink -> listEnabledResourceTypesNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of the Enabled Resource Types. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 list of the Enabled Resource Types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listEnabledResourceTypes( + String resourceGroupName, String resourceName) { + return new PagedIterable<>(listEnabledResourceTypesAsync(resourceGroupName, resourceName)); + } + + /** + * Gets the list of the Enabled Resource Types. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 list of the Enabled Resource Types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listEnabledResourceTypes( + String resourceGroupName, String resourceName, Context context) { + return new PagedIterable<>(listEnabledResourceTypesAsync(resourceGroupName, resourceName, 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 lists of Custom Locations operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsNextSinglePageAsync(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.listOperationsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 lists of Custom Locations operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsNextSinglePageAsync( + 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 + .listOperationsNext(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 the List Custom Locations operation response. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 the List Custom Locations operation response. + */ + @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 the List Custom Locations operation response. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 the List Custom Locations operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of EnabledResourceTypes definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listEnabledResourceTypesNextSinglePageAsync(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.listEnabledResourceTypesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of EnabledResourceTypes definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listEnabledResourceTypesNextSinglePageAsync( + 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 + .listEnabledResourceTypesNext(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/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsImpl.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsImpl.java new file mode 100644 index 000000000000..6e6001b52b9d --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.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.extendedlocation.fluent.CustomLocationsClient; +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationInner; +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationOperationInner; +import com.azure.resourcemanager.extendedlocation.fluent.models.EnabledResourceTypeInner; +import com.azure.resourcemanager.extendedlocation.models.CustomLocation; +import com.azure.resourcemanager.extendedlocation.models.CustomLocationOperation; +import com.azure.resourcemanager.extendedlocation.models.CustomLocations; +import com.azure.resourcemanager.extendedlocation.models.EnabledResourceType; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CustomLocationsImpl implements CustomLocations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationsImpl.class); + + private final CustomLocationsClient innerClient; + + private final com.azure.resourcemanager.extendedlocation.CustomLocationsManager serviceManager; + + public CustomLocationsImpl( + CustomLocationsClient innerClient, + com.azure.resourcemanager.extendedlocation.CustomLocationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listOperations() { + PagedIterable inner = this.serviceClient().listOperations(); + return Utils.mapPage(inner, inner1 -> new CustomLocationOperationImpl(inner1, this.manager())); + } + + public PagedIterable listOperations(Context context) { + PagedIterable inner = this.serviceClient().listOperations(context); + return Utils.mapPage(inner, inner1 -> new CustomLocationOperationImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CustomLocationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new CustomLocationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CustomLocationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new CustomLocationImpl(inner1, this.manager())); + } + + public CustomLocation getByResourceGroup(String resourceGroupName, String resourceName) { + CustomLocationInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName); + if (inner != null) { + return new CustomLocationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CustomLocationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String resourceName) { + this.serviceClient().delete(resourceGroupName, resourceName); + } + + public void delete(String resourceGroupName, String resourceName, Context context) { + this.serviceClient().delete(resourceGroupName, resourceName, context); + } + + public PagedIterable listEnabledResourceTypes(String resourceGroupName, String resourceName) { + PagedIterable inner = + this.serviceClient().listEnabledResourceTypes(resourceGroupName, resourceName); + return Utils.mapPage(inner, inner1 -> new EnabledResourceTypeImpl(inner1, this.manager())); + } + + public PagedIterable listEnabledResourceTypes( + String resourceGroupName, String resourceName, Context context) { + PagedIterable inner = + this.serviceClient().listEnabledResourceTypes(resourceGroupName, resourceName, context); + return Utils.mapPage(inner, inner1 -> new EnabledResourceTypeImpl(inner1, this.manager())); + } + + public CustomLocation getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "customLocations"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'customLocations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "customLocations"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'customLocations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "customLocations"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'customLocations'.", id))); + } + this.delete(resourceGroupName, resourceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "customLocations"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'customLocations'.", id))); + } + this.delete(resourceGroupName, resourceName, context); + } + + private CustomLocationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.extendedlocation.CustomLocationsManager manager() { + return this.serviceManager; + } + + public CustomLocationImpl define(String name) { + return new CustomLocationImpl(name, this.manager()); + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsManagementClientBuilder.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsManagementClientBuilder.java new file mode 100644 index 000000000000..02bb4057f0a6 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.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 CustomLocationsManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {CustomLocationsManagementClientImpl.class}) +public final class CustomLocationsManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the CustomLocationsManagementClientBuilder. + */ + public CustomLocationsManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the CustomLocationsManagementClientBuilder. + */ + public CustomLocationsManagementClientBuilder 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 CustomLocationsManagementClientBuilder. + */ + public CustomLocationsManagementClientBuilder 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 CustomLocationsManagementClientBuilder. + */ + public CustomLocationsManagementClientBuilder 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 CustomLocationsManagementClientBuilder. + */ + public CustomLocationsManagementClientBuilder 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 CustomLocationsManagementClientBuilder. + */ + public CustomLocationsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CustomLocationsManagementClientImpl with the provided parameters. + * + * @return an instance of CustomLocationsManagementClientImpl. + */ + public CustomLocationsManagementClientImpl 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(); + } + CustomLocationsManagementClientImpl client = + new CustomLocationsManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsManagementClientImpl.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsManagementClientImpl.java new file mode 100644 index 000000000000..a1c9efc763b8 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/CustomLocationsManagementClientImpl.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.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.extendedlocation.fluent.CustomLocationsClient; +import com.azure.resourcemanager.extendedlocation.fluent.CustomLocationsManagementClient; +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 CustomLocationsManagementClientImpl type. */ +@ServiceClient(builder = CustomLocationsManagementClientBuilder.class) +public final class CustomLocationsManagementClientImpl implements CustomLocationsManagementClient { + private final ClientLogger logger = new ClientLogger(CustomLocationsManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The CustomLocationsClient object to access its operations. */ + private final CustomLocationsClient customLocations; + + /** + * Gets the CustomLocationsClient object to access its operations. + * + * @return the CustomLocationsClient object. + */ + public CustomLocationsClient getCustomLocations() { + return this.customLocations; + } + + /** + * Initializes an instance of CustomLocationsManagementClient 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 ID of the target subscription. + * @param endpoint server parameter. + */ + CustomLocationsManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2021-08-15"; + this.customLocations = new CustomLocationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/EnabledResourceTypeImpl.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/EnabledResourceTypeImpl.java new file mode 100644 index 000000000000..bf941b575b15 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/EnabledResourceTypeImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.extendedlocation.fluent.models.EnabledResourceTypeInner; +import com.azure.resourcemanager.extendedlocation.models.EnabledResourceType; +import com.azure.resourcemanager.extendedlocation.models.EnabledResourceTypePropertiesTypesMetadataItem; +import java.util.Collections; +import java.util.List; + +public final class EnabledResourceTypeImpl implements EnabledResourceType { + private EnabledResourceTypeInner innerObject; + + private final com.azure.resourcemanager.extendedlocation.CustomLocationsManager serviceManager; + + EnabledResourceTypeImpl( + EnabledResourceTypeInner innerObject, + com.azure.resourcemanager.extendedlocation.CustomLocationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String clusterExtensionId() { + return this.innerModel().clusterExtensionId(); + } + + public String extensionType() { + return this.innerModel().extensionType(); + } + + public List typesMetadata() { + List inner = this.innerModel().typesMetadata(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EnabledResourceTypeInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.extendedlocation.CustomLocationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/Utils.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/Utils.java new file mode 100644 index 000000000000..598c553885cd --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/package-info.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/implementation/package-info.java new file mode 100644 index 000000000000..1c593d4d589a --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/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 CustomLocationsManagementClient. The customLocations Rest API spec. */ +package com.azure.resourcemanager.extendedlocation.implementation; diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocation.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocation.java new file mode 100644 index 000000000000..cf6854db3e06 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocation.java @@ -0,0 +1,450 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of CustomLocation. */ +public interface CustomLocation { + /** + * 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 systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the authentication property: This is optional input that contains the authentication that should be used to + * generate the namespace. + * + * @return the authentication value. + */ + CustomLocationPropertiesAuthentication authentication(); + + /** + * Gets the clusterExtensionIds property: Contains the reference to the add-on that contains charts to deploy CRDs + * and operators. + * + * @return the clusterExtensionIds value. + */ + List clusterExtensionIds(); + + /** + * Gets the displayName property: Display name for the Custom Locations location. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the hostResourceId property: Connected Cluster or AKS Cluster. The Custom Locations RP will perform a + * checkAccess API for listAdminCredentials permissions. + * + * @return the hostResourceId value. + */ + String hostResourceId(); + + /** + * Gets the hostType property: Type of host the Custom Locations is referencing (Kubernetes, etc...). + * + * @return the hostType value. + */ + HostType hostType(); + + /** + * Gets the namespace property: Kubernetes namespace that will be created on the specified cluster. + * + * @return the namespace value. + */ + String namespace(); + + /** + * Gets the provisioningState property: Provisioning State for the Custom Location. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationInner object. + * + * @return the inner object. + */ + CustomLocationInner innerModel(); + + /** The entirety of the CustomLocation definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The CustomLocation definition stages. */ + interface DefinitionStages { + /** The first stage of the CustomLocation definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CustomLocation 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 CustomLocation definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the CustomLocation 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, + DefinitionStages.WithAuthentication, + DefinitionStages.WithClusterExtensionIds, + DefinitionStages.WithDisplayName, + DefinitionStages.WithHostResourceId, + DefinitionStages.WithHostType, + DefinitionStages.WithNamespace, + DefinitionStages.WithProvisioningState { + /** + * Executes the create request. + * + * @return the created resource. + */ + CustomLocation create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CustomLocation create(Context context); + } + /** The stage of the CustomLocation 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 CustomLocation 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); + } + /** The stage of the CustomLocation definition allowing to specify authentication. */ + interface WithAuthentication { + /** + * Specifies the authentication property: This is optional input that contains the authentication that + * should be used to generate the namespace.. + * + * @param authentication This is optional input that contains the authentication that should be used to + * generate the namespace. + * @return the next definition stage. + */ + WithCreate withAuthentication(CustomLocationPropertiesAuthentication authentication); + } + /** The stage of the CustomLocation definition allowing to specify clusterExtensionIds. */ + interface WithClusterExtensionIds { + /** + * Specifies the clusterExtensionIds property: Contains the reference to the add-on that contains charts to + * deploy CRDs and operators.. + * + * @param clusterExtensionIds Contains the reference to the add-on that contains charts to deploy CRDs and + * operators. + * @return the next definition stage. + */ + WithCreate withClusterExtensionIds(List clusterExtensionIds); + } + /** The stage of the CustomLocation definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: Display name for the Custom Locations location.. + * + * @param displayName Display name for the Custom Locations location. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + /** The stage of the CustomLocation definition allowing to specify hostResourceId. */ + interface WithHostResourceId { + /** + * Specifies the hostResourceId property: Connected Cluster or AKS Cluster. The Custom Locations RP will + * perform a checkAccess API for listAdminCredentials permissions.. + * + * @param hostResourceId Connected Cluster or AKS Cluster. The Custom Locations RP will perform a + * checkAccess API for listAdminCredentials permissions. + * @return the next definition stage. + */ + WithCreate withHostResourceId(String hostResourceId); + } + /** The stage of the CustomLocation definition allowing to specify hostType. */ + interface WithHostType { + /** + * Specifies the hostType property: Type of host the Custom Locations is referencing (Kubernetes, etc...).. + * + * @param hostType Type of host the Custom Locations is referencing (Kubernetes, etc...). + * @return the next definition stage. + */ + WithCreate withHostType(HostType hostType); + } + /** The stage of the CustomLocation definition allowing to specify namespace. */ + interface WithNamespace { + /** + * Specifies the namespace property: Kubernetes namespace that will be created on the specified cluster.. + * + * @param namespace Kubernetes namespace that will be created on the specified cluster. + * @return the next definition stage. + */ + WithCreate withNamespace(String namespace); + } + /** The stage of the CustomLocation definition allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: Provisioning State for the Custom Location.. + * + * @param provisioningState Provisioning State for the Custom Location. + * @return the next definition stage. + */ + WithCreate withProvisioningState(String provisioningState); + } + } + /** + * Begins update for the CustomLocation resource. + * + * @return the stage of resource update. + */ + CustomLocation.Update update(); + + /** The template for CustomLocation update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithAuthentication, + UpdateStages.WithClusterExtensionIds, + UpdateStages.WithDisplayName, + UpdateStages.WithHostResourceId, + UpdateStages.WithHostType, + UpdateStages.WithNamespace, + UpdateStages.WithProvisioningState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CustomLocation apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CustomLocation apply(Context context); + } + /** The CustomLocation update stages. */ + interface UpdateStages { + /** The stage of the CustomLocation 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 CustomLocation 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); + } + /** The stage of the CustomLocation update allowing to specify authentication. */ + interface WithAuthentication { + /** + * Specifies the authentication property: This is optional input that contains the authentication that + * should be used to generate the namespace.. + * + * @param authentication This is optional input that contains the authentication that should be used to + * generate the namespace. + * @return the next definition stage. + */ + Update withAuthentication(CustomLocationPropertiesAuthentication authentication); + } + /** The stage of the CustomLocation update allowing to specify clusterExtensionIds. */ + interface WithClusterExtensionIds { + /** + * Specifies the clusterExtensionIds property: Contains the reference to the add-on that contains charts to + * deploy CRDs and operators.. + * + * @param clusterExtensionIds Contains the reference to the add-on that contains charts to deploy CRDs and + * operators. + * @return the next definition stage. + */ + Update withClusterExtensionIds(List clusterExtensionIds); + } + /** The stage of the CustomLocation update allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: Display name for the Custom Locations location.. + * + * @param displayName Display name for the Custom Locations location. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + /** The stage of the CustomLocation update allowing to specify hostResourceId. */ + interface WithHostResourceId { + /** + * Specifies the hostResourceId property: Connected Cluster or AKS Cluster. The Custom Locations RP will + * perform a checkAccess API for listAdminCredentials permissions.. + * + * @param hostResourceId Connected Cluster or AKS Cluster. The Custom Locations RP will perform a + * checkAccess API for listAdminCredentials permissions. + * @return the next definition stage. + */ + Update withHostResourceId(String hostResourceId); + } + /** The stage of the CustomLocation update allowing to specify hostType. */ + interface WithHostType { + /** + * Specifies the hostType property: Type of host the Custom Locations is referencing (Kubernetes, etc...).. + * + * @param hostType Type of host the Custom Locations is referencing (Kubernetes, etc...). + * @return the next definition stage. + */ + Update withHostType(HostType hostType); + } + /** The stage of the CustomLocation update allowing to specify namespace. */ + interface WithNamespace { + /** + * Specifies the namespace property: Kubernetes namespace that will be created on the specified cluster.. + * + * @param namespace Kubernetes namespace that will be created on the specified cluster. + * @return the next definition stage. + */ + Update withNamespace(String namespace); + } + /** The stage of the CustomLocation update allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: Provisioning State for the Custom Location.. + * + * @param provisioningState Provisioning State for the Custom Location. + * @return the next definition stage. + */ + Update withProvisioningState(String provisioningState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CustomLocation refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CustomLocation refresh(Context context); +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationListResult.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationListResult.java new file mode 100644 index 000000000000..0e78da985069 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Custom Locations operation response. */ +@Immutable +public final class CustomLocationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationListResult.class); + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /* + * The list of Custom Locations. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: The list of Custom Locations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationOperation.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationOperation.java new file mode 100644 index 000000000000..355e2104f2bd --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationOperation.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.models; + +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationOperationInner; + +/** An immutable client-side representation of CustomLocationOperation. */ +public interface CustomLocationOperation { + /** + * Gets the isDataAction property: Is this Operation a data plane operation. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the name property: The name of the compute operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the origin property: The origin of the compute operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the description property: The description of the operation. + * + * @return the description value. + */ + String description(); + + /** + * Gets the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + String provider(); + + /** + * Gets the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + String resource(); + + /** + * Gets the inner com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationOperationInner object. + * + * @return the inner object. + */ + CustomLocationOperationInner innerModel(); +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationOperationsList.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationOperationsList.java new file mode 100644 index 000000000000..ec2802f14e7a --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationOperationsList.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.extendedlocation.fluent.models.CustomLocationOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Lists of Custom Locations operations. */ +@Fluent +public final class CustomLocationOperationsList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationOperationsList.class); + + /* + * Next page of operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of customLocationOperation + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the CustomLocationOperationsList object itself. + */ + public CustomLocationOperationsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of customLocationOperation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of customLocationOperation. + * + * @param value the value value to set. + * @return the CustomLocationOperationsList object itself. + */ + public CustomLocationOperationsList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model CustomLocationOperationsList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationPropertiesAuthentication.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationPropertiesAuthentication.java new file mode 100644 index 000000000000..9c15e995a351 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocationPropertiesAuthentication.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.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; + +/** This is optional input that contains the authentication that should be used to generate the namespace. */ +@Fluent +public final class CustomLocationPropertiesAuthentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomLocationPropertiesAuthentication.class); + + /* + * The type of the Custom Locations authentication + */ + @JsonProperty(value = "type") + private String type; + + /* + * The kubeconfig value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the type property: The type of the Custom Locations authentication. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of the Custom Locations authentication. + * + * @param type the type value to set. + * @return the CustomLocationPropertiesAuthentication object itself. + */ + public CustomLocationPropertiesAuthentication withType(String type) { + this.type = type; + return this; + } + + /** + * Get the value property: The kubeconfig value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The kubeconfig value. + * + * @param value the value value to set. + * @return the CustomLocationPropertiesAuthentication object itself. + */ + public CustomLocationPropertiesAuthentication withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocations.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocations.java new file mode 100644 index 000000000000..e461398960da --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/CustomLocations.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.extendedlocation.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 CustomLocations. */ +public interface CustomLocations { + /** + * Lists all available Custom Locations 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 lists of Custom Locations operations. + */ + PagedIterable listOperations(); + + /** + * Lists all available Custom Locations 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 lists of Custom Locations operations. + */ + PagedIterable listOperations(Context context); + + /** + * Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom + * Location. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription. + */ + PagedIterable list(); + + /** + * Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom + * Location. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription. + */ + PagedIterable list(Context context); + + /** + * Gets a list of Custom Locations in the specified subscription and resource group. The operation returns + * properties of each Custom Location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription and resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of Custom Locations in the specified subscription and resource group. The operation returns + * properties of each Custom Location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Locations in the specified subscription and resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 details of the customLocation with a specified resource group and name. + */ + CustomLocation getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 details of the customLocation with a specified resource group and name. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String resourceName, Context context); + + /** + * Gets the list of the Enabled Resource Types. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 list of the Enabled Resource Types. + */ + PagedIterable listEnabledResourceTypes(String resourceGroupName, String resourceName); + + /** + * Gets the list of the Enabled Resource Types. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Custom Locations name. + * @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 list of the Enabled Resource Types. + */ + PagedIterable listEnabledResourceTypes( + String resourceGroupName, String resourceName, Context context); + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the customLocation with a specified resource group and name. + */ + CustomLocation getById(String id); + + /** + * Gets the details of the customLocation with a specified resource group and name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.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 details of the customLocation with a specified resource group and name. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CustomLocation resource. + * + * @param name resource name. + * @return the first stage of the new CustomLocation definition. + */ + CustomLocation.DefinitionStages.Blank define(String name); +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/EnabledResourceType.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/EnabledResourceType.java new file mode 100644 index 000000000000..1bb5c2e29259 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/EnabledResourceType.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.extendedlocation.fluent.models.EnabledResourceTypeInner; +import java.util.List; + +/** An immutable client-side representation of EnabledResourceType. */ +public interface EnabledResourceType { + /** + * 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 systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the clusterExtensionId property: Cluster Extension ID. + * + * @return the clusterExtensionId value. + */ + String clusterExtensionId(); + + /** + * Gets the extensionType property: Cluster Extension Type. + * + * @return the extensionType value. + */ + String extensionType(); + + /** + * Gets the typesMetadata property: Metadata of the Resource Type. + * + * @return the typesMetadata value. + */ + List typesMetadata(); + + /** + * Gets the inner com.azure.resourcemanager.extendedlocation.fluent.models.EnabledResourceTypeInner object. + * + * @return the inner object. + */ + EnabledResourceTypeInner innerModel(); +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/EnabledResourceTypePropertiesTypesMetadataItem.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/EnabledResourceTypePropertiesTypesMetadataItem.java new file mode 100644 index 000000000000..d630b5ea4c36 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/EnabledResourceTypePropertiesTypesMetadataItem.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.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; + +/** Metadata of the Resource Type. */ +@Fluent +public final class EnabledResourceTypePropertiesTypesMetadataItem { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(EnabledResourceTypePropertiesTypesMetadataItem.class); + + /* + * Api Version of Resource Type + */ + @JsonProperty(value = "apiVersion") + private String apiVersion; + + /* + * Resource Provider Namespace of Resource Type + */ + @JsonProperty(value = "resourceProviderNamespace") + private String resourceProviderNamespace; + + /* + * Resource Type + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * Get the apiVersion property: Api Version of Resource Type. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** + * Set the apiVersion property: Api Version of Resource Type. + * + * @param apiVersion the apiVersion value to set. + * @return the EnabledResourceTypePropertiesTypesMetadataItem object itself. + */ + public EnabledResourceTypePropertiesTypesMetadataItem withApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /** + * Get the resourceProviderNamespace property: Resource Provider Namespace of Resource Type. + * + * @return the resourceProviderNamespace value. + */ + public String resourceProviderNamespace() { + return this.resourceProviderNamespace; + } + + /** + * Set the resourceProviderNamespace property: Resource Provider Namespace of Resource Type. + * + * @param resourceProviderNamespace the resourceProviderNamespace value to set. + * @return the EnabledResourceTypePropertiesTypesMetadataItem object itself. + */ + public EnabledResourceTypePropertiesTypesMetadataItem withResourceProviderNamespace( + String resourceProviderNamespace) { + this.resourceProviderNamespace = resourceProviderNamespace; + return this; + } + + /** + * Get the resourceType property: Resource Type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Resource Type. + * + * @param resourceType the resourceType value to set. + * @return the EnabledResourceTypePropertiesTypesMetadataItem object itself. + */ + public EnabledResourceTypePropertiesTypesMetadataItem withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/EnabledResourceTypesListResult.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/EnabledResourceTypesListResult.java new file mode 100644 index 000000000000..0ab3758ca745 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/EnabledResourceTypesListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.extendedlocation.fluent.models.EnabledResourceTypeInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of EnabledResourceTypes definition. */ +@Immutable +public final class EnabledResourceTypesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnabledResourceTypesListResult.class); + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /* + * The list of EnabledResourceTypes available for a customLocation. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: The list of EnabledResourceTypes available for a customLocation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/HostType.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/HostType.java new file mode 100644 index 000000000000..48b3f2b9036d --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/HostType.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.extendedlocation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HostType. */ +public final class HostType extends ExpandableStringEnum { + /** Static value Kubernetes for HostType. */ + public static final HostType KUBERNETES = fromString("Kubernetes"); + + /** + * Creates or finds a HostType from its string representation. + * + * @param name a name to look for. + * @return the corresponding HostType. + */ + @JsonCreator + public static HostType fromString(String name) { + return fromString(name, HostType.class); + } + + /** @return known HostType values. */ + public static Collection values() { + return values(HostType.class); + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/Identity.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/Identity.java new file mode 100644 index 000000000000..f8e3e6b3e07a --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/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.extendedlocation.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/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/PatchableCustomLocations.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/PatchableCustomLocations.java new file mode 100644 index 000000000000..090646288665 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/PatchableCustomLocations.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.extendedlocation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The Custom Locations patchable resource definition. */ +@JsonFlatten +@Fluent +public class PatchableCustomLocations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PatchableCustomLocations.class); + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * This is optional input that contains the authentication that should be + * used to generate the namespace. + */ + @JsonProperty(value = "properties.authentication") + private CustomLocationPropertiesAuthentication authentication; + + /* + * Contains the reference to the add-on that contains charts to deploy CRDs + * and operators. + */ + @JsonProperty(value = "properties.clusterExtensionIds") + private List clusterExtensionIds; + + /* + * Display name for the Custom Locations location. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * Connected Cluster or AKS Cluster. The Custom Locations RP will perform a + * checkAccess API for listAdminCredentials permissions. + */ + @JsonProperty(value = "properties.hostResourceId") + private String hostResourceId; + + /* + * Type of host the Custom Locations is referencing (Kubernetes, etc...). + */ + @JsonProperty(value = "properties.hostType") + private HostType hostType; + + /* + * Kubernetes namespace that will be created on the specified cluster. + */ + @JsonProperty(value = "properties.namespace") + private String namespace; + + /* + * Provisioning State for the Custom Location. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * 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 PatchableCustomLocations object itself. + */ + public PatchableCustomLocations withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the PatchableCustomLocations object itself. + */ + public PatchableCustomLocations withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the authentication property: This is optional input that contains the authentication that should be used to + * generate the namespace. + * + * @return the authentication value. + */ + public CustomLocationPropertiesAuthentication authentication() { + return this.authentication; + } + + /** + * Set the authentication property: This is optional input that contains the authentication that should be used to + * generate the namespace. + * + * @param authentication the authentication value to set. + * @return the PatchableCustomLocations object itself. + */ + public PatchableCustomLocations withAuthentication(CustomLocationPropertiesAuthentication authentication) { + this.authentication = authentication; + return this; + } + + /** + * Get the clusterExtensionIds property: Contains the reference to the add-on that contains charts to deploy CRDs + * and operators. + * + * @return the clusterExtensionIds value. + */ + public List clusterExtensionIds() { + return this.clusterExtensionIds; + } + + /** + * Set the clusterExtensionIds property: Contains the reference to the add-on that contains charts to deploy CRDs + * and operators. + * + * @param clusterExtensionIds the clusterExtensionIds value to set. + * @return the PatchableCustomLocations object itself. + */ + public PatchableCustomLocations withClusterExtensionIds(List clusterExtensionIds) { + this.clusterExtensionIds = clusterExtensionIds; + return this; + } + + /** + * Get the displayName property: Display name for the Custom Locations location. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name for the Custom Locations location. + * + * @param displayName the displayName value to set. + * @return the PatchableCustomLocations object itself. + */ + public PatchableCustomLocations withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the hostResourceId property: Connected Cluster or AKS Cluster. The Custom Locations RP will perform a + * checkAccess API for listAdminCredentials permissions. + * + * @return the hostResourceId value. + */ + public String hostResourceId() { + return this.hostResourceId; + } + + /** + * Set the hostResourceId property: Connected Cluster or AKS Cluster. The Custom Locations RP will perform a + * checkAccess API for listAdminCredentials permissions. + * + * @param hostResourceId the hostResourceId value to set. + * @return the PatchableCustomLocations object itself. + */ + public PatchableCustomLocations withHostResourceId(String hostResourceId) { + this.hostResourceId = hostResourceId; + return this; + } + + /** + * Get the hostType property: Type of host the Custom Locations is referencing (Kubernetes, etc...). + * + * @return the hostType value. + */ + public HostType hostType() { + return this.hostType; + } + + /** + * Set the hostType property: Type of host the Custom Locations is referencing (Kubernetes, etc...). + * + * @param hostType the hostType value to set. + * @return the PatchableCustomLocations object itself. + */ + public PatchableCustomLocations withHostType(HostType hostType) { + this.hostType = hostType; + return this; + } + + /** + * Get the namespace property: Kubernetes namespace that will be created on the specified cluster. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: Kubernetes namespace that will be created on the specified cluster. + * + * @param namespace the namespace value to set. + * @return the PatchableCustomLocations object itself. + */ + public PatchableCustomLocations withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the provisioningState property: Provisioning State for the Custom Location. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provisioning State for the Custom Location. + * + * @param provisioningState the provisioningState value to set. + * @return the PatchableCustomLocations object itself. + */ + public PatchableCustomLocations withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (authentication() != null) { + authentication().validate(); + } + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/ResourceIdentityType.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/ResourceIdentityType.java new file mode 100644 index 000000000000..599f36c5195a --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/ResourceIdentityType.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.extendedlocation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceIdentityType. */ +public final class ResourceIdentityType extends ExpandableStringEnum { + /** Static value SystemAssigned for ResourceIdentityType. */ + public static final ResourceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value None for ResourceIdentityType. */ + public static final ResourceIdentityType NONE = fromString("None"); + + /** + * Creates or finds a ResourceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceIdentityType. + */ + @JsonCreator + public static ResourceIdentityType fromString(String name) { + return fromString(name, ResourceIdentityType.class); + } + + /** @return known ResourceIdentityType values. */ + public static Collection values() { + return values(ResourceIdentityType.class); + } +} diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/package-info.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/models/package-info.java new file mode 100644 index 000000000000..84237f95a59c --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/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 CustomLocationsManagementClient. The customLocations Rest API spec. */ +package com.azure.resourcemanager.extendedlocation.models; diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/package-info.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/package-info.java new file mode 100644 index 000000000000..aa5f31c25ca7 --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/com/azure/resourcemanager/extendedlocation/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 CustomLocationsManagementClient. The customLocations Rest API spec. */ +package com.azure.resourcemanager.extendedlocation; diff --git a/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/module-info.java b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/src/main/java/module-info.java new file mode 100644 index 000000000000..51ebb3274a6c --- /dev/null +++ b/sdk/extendedlocation/azure-resourcemanager-extendedlocation/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.extendedlocation { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.extendedlocation; + exports com.azure.resourcemanager.extendedlocation.fluent; + exports com.azure.resourcemanager.extendedlocation.fluent.models; + exports com.azure.resourcemanager.extendedlocation.models; + + opens com.azure.resourcemanager.extendedlocation.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.extendedlocation.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/extendedlocation/ci.yml b/sdk/extendedlocation/ci.yml new file mode 100644 index 000000000000..d04a147f1301 --- /dev/null +++ b/sdk/extendedlocation/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/extendedlocation/ci.yml + - sdk/extendedlocation/azure-resourcemanager-extendedlocation/ + exclude: + - sdk/extendedlocation/pom.xml + - sdk/extendedlocation/azure-resourcemanager-extendedlocation/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/extendedlocation/ci.yml + - sdk/extendedlocation/azure-resourcemanager-extendedlocation/ + exclude: + - sdk/extendedlocation/pom.xml + - sdk/extendedlocation/azure-resourcemanager-extendedlocation/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: extendedlocation + Artifacts: + - name: azure-resourcemanager-extendedlocation + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerextendedlocation diff --git a/sdk/extendedlocation/pom.xml b/sdk/extendedlocation/pom.xml new file mode 100644 index 000000000000..25012933d121 --- /dev/null +++ b/sdk/extendedlocation/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-extendedlocation-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-extendedlocation + + + +