From 0ce9ff9f7dde73aa3546f101d21d757f0b87b43e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 1 Mar 2021 08:42:45 +0000 Subject: [PATCH] CodeGen from PR 13172 in Azure/azure-rest-api-specs Merge db39b2f5bb9ad5304f131fdfe0558047868e077b into be2b34ff9b0f98e00147931e9a536ea7f51d0674 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../azure-resourcemanager-adp/CHANGELOG.md | 5 + sdk/adp/azure-resourcemanager-adp/README.md | 99 + sdk/adp/azure-resourcemanager-adp/pom.xml | 67 + .../azure/resourcemanager/adp/AdpManager.java | 238 +++ .../adp/fluent/AccountsClient.java | 319 +++ .../adp/fluent/AdpManagementClient.java | 67 + .../adp/fluent/DataPoolsClient.java | 291 +++ .../adp/fluent/OperationsClient.java | 36 + .../adp/fluent/models/AccountInner.java | 92 + .../CheckNameAvailabilityResultInner.java | 75 + .../adp/fluent/models/DataPoolInner.java | 109 ++ .../adp/fluent/models/OperationInner.java | 190 ++ .../adp/fluent/models/package-info.java | 6 + .../adp/fluent/package-info.java | 6 + .../adp/implementation/AccountImpl.java | 184 ++ .../implementation/AccountsClientImpl.java | 1734 +++++++++++++++++ .../adp/implementation/AccountsImpl.java | 197 ++ .../AdpManagementClientBuilder.java | 146 ++ .../AdpManagementClientImpl.java | 321 +++ .../CheckNameAvailabilityResultImpl.java | 41 + .../adp/implementation/DataPoolImpl.java | 166 ++ .../implementation/DataPoolsClientImpl.java | 1449 ++++++++++++++ .../adp/implementation/DataPoolsImpl.java | 188 ++ .../adp/implementation/OperationImpl.java | 54 + .../implementation/OperationsClientImpl.java | 269 +++ .../adp/implementation/OperationsImpl.java | 46 + .../adp/implementation/Utils.java | 196 ++ .../adp/implementation/package-info.java | 6 + .../resourcemanager/adp/models/Account.java | 213 ++ ...ccountCheckNameAvailabilityParameters.java | 88 + .../adp/models/AccountList.java | 70 + .../adp/models/AccountPatch.java | 66 + .../resourcemanager/adp/models/Accounts.java | 179 ++ .../models/CheckNameAvailabilityReason.java | 34 + .../models/CheckNameAvailabilityResult.java | 40 + .../adp/models/CreatedByType.java | 40 + .../resourcemanager/adp/models/DataPool.java | 174 ++ .../adp/models/DataPoolBaseProperties.java | 103 + .../adp/models/DataPoolEncryption.java | 151 ++ .../adp/models/DataPoolList.java | 70 + .../adp/models/DataPoolLocation.java | 84 + .../adp/models/DataPoolPatch.java | 106 + .../adp/models/DataPoolProperties.java | 33 + .../resourcemanager/adp/models/DataPools.java | 142 ++ .../resourcemanager/adp/models/Operation.java | 59 + .../adp/models/OperationDisplay.java | 128 ++ .../adp/models/OperationListResult.java | 81 + .../adp/models/OperationLogSpecification.java | 102 + .../models/OperationMetricAvailability.java | 76 + .../models/OperationMetricSpecification.java | 262 +++ .../models/OperationServiceSpecification.java | 84 + .../adp/models/Operations.java | 31 + .../adp/models/ProvisioningState.java | 46 + .../adp/models/SystemData.java | 181 ++ .../resourcemanager/adp/models/Tags.java | 51 + .../resourcemanager/adp/models/Type.java | 32 + .../adp/models/package-info.java | 6 + .../resourcemanager/adp/package-info.java | 6 + .../src/main/java/module-info.java | 19 + sdk/adp/ci.yml | 33 + sdk/adp/pom.xml | 53 + 63 files changed, 9442 insertions(+) create mode 100644 sdk/adp/azure-resourcemanager-adp/CHANGELOG.md create mode 100644 sdk/adp/azure-resourcemanager-adp/README.md create mode 100644 sdk/adp/azure-resourcemanager-adp/pom.xml create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/AdpManager.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/AccountsClient.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/AdpManagementClient.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/DataPoolsClient.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/OperationsClient.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/AccountInner.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/CheckNameAvailabilityResultInner.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/DataPoolInner.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/OperationInner.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/package-info.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/package-info.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountsClientImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountsImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AdpManagementClientBuilder.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AdpManagementClientImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/CheckNameAvailabilityResultImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolsClientImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolsImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationsClientImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationsImpl.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/Utils.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/package-info.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Account.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountCheckNameAvailabilityParameters.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountList.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountPatch.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Accounts.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CheckNameAvailabilityReason.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CheckNameAvailabilityResult.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CreatedByType.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPool.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolBaseProperties.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolEncryption.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolList.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolLocation.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolPatch.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolProperties.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPools.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Operation.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationDisplay.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationListResult.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationLogSpecification.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationMetricAvailability.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationMetricSpecification.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationServiceSpecification.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Operations.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/ProvisioningState.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/SystemData.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Tags.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Type.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/package-info.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/package-info.java create mode 100644 sdk/adp/azure-resourcemanager-adp/src/main/java/module-info.java create mode 100644 sdk/adp/ci.yml create mode 100644 sdk/adp/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 34096f145fd60..799b50a93c293 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -207,6 +207,7 @@ com.azure.resourcemanager:azure-resourcemanager-netapp;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagecache;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-adp;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 cbd853bff078c..033c8658c6796 100644 --- a/pom.xml +++ b/pom.xml @@ -574,6 +574,7 @@ common/perf-test-core eng/code-quality-reports eng/jacoco-test-coverage + sdk/adp sdk/anomalydetector sdk/appconfiguration sdk/attestation diff --git a/sdk/adp/azure-resourcemanager-adp/CHANGELOG.md b/sdk/adp/azure-resourcemanager-adp/CHANGELOG.md new file mode 100644 index 0000000000000..7e29a6a9f524a --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-01) + +- Azure Resource Manager Adp client library for Java. This package contains Microsoft Azure SDK for Adp Management SDK. Microsoft Autonomous Development Platform. Package tag package-2021-02-01-preview. 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/adp/azure-resourcemanager-adp/README.md b/sdk/adp/azure-resourcemanager-adp/README.md new file mode 100644 index 0000000000000..5aad5c1bc02c1 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Adp client library for Java + +Azure Resource Manager Adp client library for Java. + +This package contains Microsoft Azure SDK for Adp Management SDK. Microsoft Autonomous Development Platform. Package tag package-2021-02-01-preview. 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-adp;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-adp + 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(); +AdpManager manager = AdpManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/adp/azure-resourcemanager-adp/pom.xml b/sdk/adp/azure-resourcemanager-adp/pom.xml new file mode 100644 index 0000000000000..1a42bbf9e6d40 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-adp + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Adp Management + This package contains Microsoft Azure SDK for Adp Management SDK. Microsoft Autonomous Development Platform. Package tag package-2021-02-01-preview. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.13.0 + + + com.azure + azure-core-management + 1.1.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/AdpManager.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/AdpManager.java new file mode 100644 index 0000000000000..4d6bb5064bcc9 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/AdpManager.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.adp.fluent.AdpManagementClient; +import com.azure.resourcemanager.adp.implementation.AccountsImpl; +import com.azure.resourcemanager.adp.implementation.AdpManagementClientBuilder; +import com.azure.resourcemanager.adp.implementation.DataPoolsImpl; +import com.azure.resourcemanager.adp.implementation.OperationsImpl; +import com.azure.resourcemanager.adp.models.Accounts; +import com.azure.resourcemanager.adp.models.DataPools; +import com.azure.resourcemanager.adp.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to AdpManager. Microsoft Autonomous Development Platform. */ +public final class AdpManager { + private Operations operations; + + private Accounts accounts; + + private DataPools dataPools; + + private final AdpManagementClient clientObject; + + private AdpManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AdpManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Adp service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Adp service API instance. + */ + public static AdpManager 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 AdpManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AdpManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Adp service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Adp service API instance. + */ + public AdpManager 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.adp") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new AdpManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of Accounts. */ + public Accounts accounts() { + if (this.accounts == null) { + this.accounts = new AccountsImpl(clientObject.getAccounts(), this); + } + return accounts; + } + + /** @return Resource collection API of DataPools. */ + public DataPools dataPools() { + if (this.dataPools == null) { + this.dataPools = new DataPoolsImpl(clientObject.getDataPools(), this); + } + return dataPools; + } + + /** + * @return Wrapped service client AdpManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public AdpManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/AccountsClient.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/AccountsClient.java new file mode 100644 index 0000000000000..2675232e6c7d5 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/AccountsClient.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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.adp.fluent.models.AccountInner; +import com.azure.resourcemanager.adp.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.adp.models.AccountCheckNameAvailabilityParameters; +import com.azure.resourcemanager.adp.models.AccountPatch; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public interface AccountsClient { + /** + * Checks that the account name is valid and is not already in use. + * + * @param parameters The checkNameAvailability parameters. + * @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 checkNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResultInner checkNameAvailability(AccountCheckNameAvailabilityParameters parameters); + + /** + * Checks that the account name is valid and is not already in use. + * + * @param parameters The checkNameAvailability parameters. + * @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 checkNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + AccountCheckNameAvailabilityParameters parameters, Context context); + + /** + * List all ADP accounts available under the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all ADP accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List all ADP accounts available under the resource group. + * + * @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 the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all ADP accounts available under the resource group. + * + * @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 the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the properties of an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Gets the properties of an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AccountInner> beginUpdate( + String resourceGroupName, String accountName, AccountPatch parameters); + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AccountInner> beginUpdate( + String resourceGroupName, String accountName, AccountPatch parameters, Context context); + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner update(String resourceGroupName, String accountName, AccountPatch parameters); + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner update(String resourceGroupName, String accountName); + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner update(String resourceGroupName, String accountName, AccountPatch parameters, Context context); + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AccountInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, AccountInner parameters); + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AccountInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, AccountInner parameters, Context context); + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner createOrUpdate(String resourceGroupName, String accountName, AccountInner parameters); + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner createOrUpdate(String resourceGroupName, String accountName); + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner createOrUpdate(String resourceGroupName, String accountName, AccountInner parameters, Context context); + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName); + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, Context context); + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName); + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, Context context); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/AdpManagementClient.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/AdpManagementClient.java new file mode 100644 index 0000000000000..ce1159ebf94d2 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/AdpManagementClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AdpManagementClient class. */ +public interface AdpManagementClient { + /** + * 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 OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + AccountsClient getAccounts(); + + /** + * Gets the DataPoolsClient object to access its operations. + * + * @return the DataPoolsClient object. + */ + DataPoolsClient getDataPools(); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/DataPoolsClient.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/DataPoolsClient.java new file mode 100644 index 0000000000000..8df5c841b617c --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/DataPoolsClient.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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.adp.fluent.models.DataPoolInner; +import com.azure.resourcemanager.adp.models.DataPoolPatch; + +/** An instance of this class provides access to all the operations defined in DataPoolsClient. */ +public interface DataPoolsClient { + /** + * Lists the data pools under the ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String accountName); + + /** + * Lists the data pools under the ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String accountName, Context context); + + /** + * Gets the properties of a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataPoolInner get(String resourceGroupName, String accountName, String dataPoolName); + + /** + * Gets the properties of a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String dataPoolName, Context context); + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DataPoolInner> beginUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters); + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DataPoolInner> beginUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters, Context context); + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataPoolInner update(String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters); + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataPoolInner update(String resourceGroupName, String accountName, String dataPoolName); + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataPoolInner update( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters, Context context); + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DataPoolInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters); + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DataPoolInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters, Context context); + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataPoolInner createOrUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters); + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataPoolInner createOrUpdate(String resourceGroupName, String accountName, String dataPoolName); + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataPoolInner createOrUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters, Context context); + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName); + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName, Context context); + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String dataPoolName); + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName, Context context); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/OperationsClient.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/OperationsClient.java new file mode 100644 index 0000000000000..1b9e9e45cf550 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.adp.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Autonomous Development Platform provider 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available Autonomous Development Platform provider 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/AccountInner.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/AccountInner.java new file mode 100644 index 0000000000000..519b2f9b7ea08 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/AccountInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.adp.models.ProvisioningState; +import com.azure.resourcemanager.adp.models.SystemData; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** ADP account. */ +@JsonFlatten +@Immutable +public class AccountInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountInner.class); + + /* + * The system meta data relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The account's data-plane ID + */ + @JsonProperty(value = "properties.accountId", access = JsonProperty.Access.WRITE_ONLY) + private String accountId; + + /* + * Gets the status of the account at the time the operation was called + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the accountId property: The account's data-plane ID. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the provisioningState property: Gets the status of the account at the time the operation was called. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** {@inheritDoc} */ + @Override + public AccountInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AccountInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (systemData() != null) { + systemData().validate(); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 0000000000000..509aa56284913 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.adp.models.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The checkNameAvailability operation response. */ +@Immutable +public final class CheckNameAvailabilityResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResultInner.class); + + /* + * Gets a boolean value that indicates whether the name is available for + * you to use. If true, the name is available. If false, the name has + * already been taken or is invalid and cannot be used + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /* + * Gets the reason that an account name could not be used. The reason + * element is only returned if nameAvailable is false + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private CheckNameAvailabilityReason reason; + + /* + * Gets an error message explaining the reason value in more detail + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the nameAvailable property: Gets a boolean value that indicates whether the name is available for you to use. + * If true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: Gets the reason that an account name could not be used. The reason element is only + * returned if nameAvailable is false. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: Gets an error message explaining the reason value in more detail. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/DataPoolInner.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/DataPoolInner.java new file mode 100644 index 0000000000000..45c60da85e5ee --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/DataPoolInner.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.adp.models.DataPoolLocation; +import com.azure.resourcemanager.adp.models.ProvisioningState; +import com.azure.resourcemanager.adp.models.SystemData; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** ADP Data Pool. */ +@JsonFlatten +@Fluent +public class DataPoolInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataPoolInner.class); + + /* + * The Data Pool's data-plane ID + */ + @JsonProperty(value = "properties.dataPoolId", access = JsonProperty.Access.WRITE_ONLY) + private String dataPoolId; + + /* + * Gets the status of the data pool at the time the operation was called + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Gets or sets the collection of locations where Data Pool resources + * should be created + */ + @JsonProperty(value = "properties.locations") + private List locations; + + /* + * The system meta data relating to this resource + */ + @JsonProperty(value = "properties.systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the dataPoolId property: The Data Pool's data-plane ID. + * + * @return the dataPoolId value. + */ + public String dataPoolId() { + return this.dataPoolId; + } + + /** + * Get the provisioningState property: Gets the status of the data pool at the time the operation was called. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the locations property: Gets or sets the collection of locations where Data Pool resources should be created. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: Gets or sets the collection of locations where Data Pool resources should be created. + * + * @param locations the locations value to set. + * @return the DataPoolInner object itself. + */ + public DataPoolInner withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + if (systemData() != null) { + systemData().validate(); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/OperationInner.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..d2cdcada4aebe --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/OperationInner.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.adp.models.OperationDisplay; +import com.azure.resourcemanager.adp.models.OperationServiceSpecification; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation detail payload. */ +@JsonFlatten +@Fluent +public class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Name of the operation + */ + @JsonProperty(value = "name") + private String name; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * Indicates the action type + */ + @JsonProperty(value = "actionType") + private String actionType; + + /* + * Display of the operation + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * Origin of the operation + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * Details about a service operation + */ + @JsonProperty(value = "properties.serviceSpecification") + private OperationServiceSpecification serviceSpecification; + + /** + * Get the name property: Name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the operation. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationInner object itself. + */ + public OperationInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the actionType property: Indicates the action type. + * + * @return the actionType value. + */ + public String actionType() { + return this.actionType; + } + + /** + * Set the actionType property: Indicates the action type. + * + * @param actionType the actionType value to set. + * @return the OperationInner object itself. + */ + public OperationInner withActionType(String actionType) { + this.actionType = actionType; + return this; + } + + /** + * Get the display property: Display of the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display of the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Origin of the operation. + * + * @param origin the origin value to set. + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the serviceSpecification property: Details about a service operation. + * + * @return the serviceSpecification value. + */ + public OperationServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set the serviceSpecification property: Details about a service operation. + * + * @param serviceSpecification the serviceSpecification value to set. + * @return the OperationInner object itself. + */ + public OperationInner withServiceSpecification(OperationServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + if (serviceSpecification() != null) { + serviceSpecification().validate(); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/package-info.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/models/package-info.java new file mode 100644 index 0000000000000..020d0d8284080 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/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 AdpManagementClient. Microsoft Autonomous Development Platform. */ +package com.azure.resourcemanager.adp.fluent.models; diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/package-info.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/fluent/package-info.java new file mode 100644 index 0000000000000..6048f0fcdf342 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/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 AdpManagementClient. Microsoft Autonomous Development Platform. */ +package com.azure.resourcemanager.adp.fluent; diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountImpl.java new file mode 100644 index 0000000000000..ee1dab684ca11 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountImpl.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.adp.AdpManager; +import com.azure.resourcemanager.adp.fluent.models.AccountInner; +import com.azure.resourcemanager.adp.models.Account; +import com.azure.resourcemanager.adp.models.AccountPatch; +import com.azure.resourcemanager.adp.models.ProvisioningState; +import com.azure.resourcemanager.adp.models.SystemData; +import java.util.Collections; +import java.util.Map; + +public final class AccountImpl implements Account, Account.Definition, Account.Update { + private AccountInner innerObject; + + private final AdpManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String accountId() { + return this.innerModel().accountId(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public AccountInner innerModel() { + return this.innerObject; + } + + private AdpManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private AccountPatch updateParameters; + + public AccountImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Account create() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .createOrUpdate(resourceGroupName, accountName, this.innerModel(), Context.NONE); + return this; + } + + public Account create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .createOrUpdate(resourceGroupName, accountName, this.innerModel(), context); + return this; + } + + AccountImpl(String name, AdpManager serviceManager) { + this.innerObject = new AccountInner(); + this.serviceManager = serviceManager; + this.accountName = name; + } + + public AccountImpl update() { + this.updateParameters = new AccountPatch(); + return this; + } + + public Account apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .update(resourceGroupName, accountName, updateParameters, Context.NONE); + return this; + } + + public Account apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .update(resourceGroupName, accountName, updateParameters, context); + return this; + } + + AccountImpl(AccountInner innerObject, AdpManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "accounts"); + } + + public Account refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public Account refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public AccountImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AccountImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AccountImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountsClientImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountsClientImpl.java new file mode 100644 index 0000000000000..dd65bd0e11930 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountsClientImpl.java @@ -0,0 +1,1734 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.adp.fluent.AccountsClient; +import com.azure.resourcemanager.adp.fluent.models.AccountInner; +import com.azure.resourcemanager.adp.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.adp.models.AccountCheckNameAvailabilityParameters; +import com.azure.resourcemanager.adp.models.AccountList; +import com.azure.resourcemanager.adp.models.AccountPatch; +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 AccountsClient. */ +public final class AccountsClientImpl implements AccountsClient { + private final ClientLogger logger = new ClientLogger(AccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AccountsService service; + + /** The service client containing this operation class. */ + private final AdpManagementClientImpl client; + + /** + * Initializes an instance of AccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccountsClientImpl(AdpManagementClientImpl client) { + this.service = RestProxy.create(AccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdpManagementClientAccounts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AdpManagementClientA") + private interface AccountsService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.AutonomousDevelopmentPlatform/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AccountCheckNameAvailabilityParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AutonomousDevelopmentPlatform/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.AutonomousDevelopmentPlatform/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AccountPatch parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AccountInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @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); + } + + /** + * Checks that the account name is valid and is not already in use. + * + * @param parameters The checkNameAvailability parameters. + * @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 checkNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + AccountCheckNameAvailabilityParameters 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 (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 + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Checks that the account name is valid and is not already in use. + * + * @param parameters The checkNameAvailability parameters. + * @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 checkNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + AccountCheckNameAvailabilityParameters 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 (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 + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Checks that the account name is valid and is not already in use. + * + * @param parameters The checkNameAvailability parameters. + * @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 checkNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + AccountCheckNameAvailabilityParameters parameters) { + return checkNameAvailabilityWithResponseAsync(parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks that the account name is valid and is not already in use. + * + * @param parameters The checkNameAvailability parameters. + * @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 checkNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResultInner checkNameAvailability(AccountCheckNameAvailabilityParameters parameters) { + return checkNameAvailabilityAsync(parameters).block(); + } + + /** + * Checks that the account name is valid and is not already in use. + * + * @param parameters The checkNameAvailability parameters. + * @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 checkNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + AccountCheckNameAvailabilityParameters parameters, Context context) { + return checkNameAvailabilityWithResponseAsync(parameters, context).block(); + } + + /** + * List all ADP accounts available under the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all ADP accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all ADP accounts available under the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all ADP accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all ADP accounts available under the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all ADP accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List all ADP accounts available under the resource group. + * + * @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 the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all ADP accounts available under the resource group. + * + * @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 the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all ADP accounts available under the resource group. + * + * @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 the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List all ADP accounts available under the resource group. + * + * @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 the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List all ADP accounts available under the resource group. + * + * @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 the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all ADP accounts available under the resource group. + * + * @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 the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the properties of an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the properties of an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the properties of an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the properties of an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupAsync(resourceGroupName, accountName).block(); + } + + /** + * Gets the properties of an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String accountName, AccountPatch 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String accountName, AccountPatch 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AccountInner> beginUpdateAsync( + String resourceGroupName, String accountName, AccountPatch parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, accountName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccountInner.class, AccountInner.class, Context.NONE); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AccountInner> beginUpdateAsync( + String resourceGroupName, String accountName, AccountPatch parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, accountName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccountInner.class, AccountInner.class, context); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AccountInner> beginUpdate( + String resourceGroupName, String accountName, AccountPatch parameters) { + return beginUpdateAsync(resourceGroupName, accountName, parameters).getSyncPoller(); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AccountInner> beginUpdate( + String resourceGroupName, String accountName, AccountPatch parameters, Context context) { + return beginUpdateAsync(resourceGroupName, accountName, parameters, context).getSyncPoller(); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String accountName, AccountPatch parameters) { + return beginUpdateAsync(resourceGroupName, accountName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String accountName) { + final AccountPatch parameters = null; + return beginUpdateAsync(resourceGroupName, accountName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, AccountPatch parameters, Context context) { + return beginUpdateAsync(resourceGroupName, accountName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner update(String resourceGroupName, String accountName, AccountPatch parameters) { + return updateAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner update(String resourceGroupName, String accountName) { + final AccountPatch parameters = null; + return updateAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Updates the properties of an existing ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the current ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner update(String resourceGroupName, String accountName, AccountPatch parameters, Context context) { + return updateAsync(resourceGroupName, accountName, parameters, context).block(); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String accountName, AccountInner 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String accountName, AccountInner 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AccountInner> beginCreateOrUpdateAsync( + String resourceGroupName, String accountName, AccountInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccountInner.class, AccountInner.class, Context.NONE); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AccountInner> beginCreateOrUpdateAsync( + String resourceGroupName, String accountName, AccountInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccountInner.class, AccountInner.class, context); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AccountInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, AccountInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AccountInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, AccountInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String accountName, AccountInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String accountName) { + final AccountInner parameters = null; + return beginCreateOrUpdateAsync(resourceGroupName, accountName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String accountName, AccountInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner createOrUpdate(String resourceGroupName, String accountName, AccountInner parameters) { + return createOrUpdateAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner createOrUpdate(String resourceGroupName, String accountName) { + final AccountInner parameters = null; + return createOrUpdateAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Creates or updates an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param parameters The parameters to provide for the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aDP account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner createOrUpdate( + String resourceGroupName, String accountName, AccountInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, accountName, parameters, context).block(); + } + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String accountName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName) { + return beginDeleteAsync(resourceGroupName, accountName).getSyncPoller(); + } + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, context).getSyncPoller(); + } + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName) { + return beginDeleteAsync(resourceGroupName, accountName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName) { + deleteAsync(resourceGroupName, accountName).block(); + } + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, Context context) { + deleteAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountsImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountsImpl.java new file mode 100644 index 0000000000000..f1aa517e46d59 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AccountsImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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.adp.AdpManager; +import com.azure.resourcemanager.adp.fluent.AccountsClient; +import com.azure.resourcemanager.adp.fluent.models.AccountInner; +import com.azure.resourcemanager.adp.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.adp.models.Account; +import com.azure.resourcemanager.adp.models.AccountCheckNameAvailabilityParameters; +import com.azure.resourcemanager.adp.models.Accounts; +import com.azure.resourcemanager.adp.models.CheckNameAvailabilityResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AccountsImpl implements Accounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountsImpl.class); + + private final AccountsClient innerClient; + + private final AdpManager serviceManager; + + public AccountsImpl(AccountsClient innerClient, AdpManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CheckNameAvailabilityResult checkNameAvailability(AccountCheckNameAvailabilityParameters parameters) { + CheckNameAvailabilityResultInner inner = this.serviceClient().checkNameAvailability(parameters); + if (inner != null) { + return new CheckNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + AccountCheckNameAvailabilityParameters parameters, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public Account getByResourceGroup(String resourceGroupName, String accountName) { + AccountInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, accountName); + if (inner != null) { + return new AccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String accountName) { + this.serviceClient().delete(resourceGroupName, accountName); + } + + public void delete(String resourceGroupName, String accountName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, context); + } + + public Account getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.delete(resourceGroupName, accountName, 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 accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.delete(resourceGroupName, accountName, context); + } + + private AccountsClient serviceClient() { + return this.innerClient; + } + + private AdpManager manager() { + return this.serviceManager; + } + + public AccountImpl define(String name) { + return new AccountImpl(name, this.manager()); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AdpManagementClientBuilder.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AdpManagementClientBuilder.java new file mode 100644 index 0000000000000..a2aab89d6f302 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AdpManagementClientBuilder.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.adp.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 AdpManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {AdpManagementClientImpl.class}) +public final class AdpManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the AdpManagementClientBuilder. + */ + public AdpManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AdpManagementClientBuilder. + */ + public AdpManagementClientBuilder 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 AdpManagementClientBuilder. + */ + public AdpManagementClientBuilder 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 AdpManagementClientBuilder. + */ + public AdpManagementClientBuilder 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 AdpManagementClientBuilder. + */ + public AdpManagementClientBuilder 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 AdpManagementClientBuilder. + */ + public AdpManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AdpManagementClientImpl with the provided parameters. + * + * @return an instance of AdpManagementClientImpl. + */ + public AdpManagementClientImpl 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(); + } + AdpManagementClientImpl client = + new AdpManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AdpManagementClientImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AdpManagementClientImpl.java new file mode 100644 index 0000000000000..7a8f350f2dc3f --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/AdpManagementClientImpl.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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.adp.fluent.AccountsClient; +import com.azure.resourcemanager.adp.fluent.AdpManagementClient; +import com.azure.resourcemanager.adp.fluent.DataPoolsClient; +import com.azure.resourcemanager.adp.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the AdpManagementClientImpl type. */ +@ServiceClient(builder = AdpManagementClientBuilder.class) +public final class AdpManagementClientImpl implements AdpManagementClient { + private final ClientLogger logger = new ClientLogger(AdpManagementClientImpl.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 OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The AccountsClient object to access its operations. */ + private final AccountsClient accounts; + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + public AccountsClient getAccounts() { + return this.accounts; + } + + /** The DataPoolsClient object to access its operations. */ + private final DataPoolsClient dataPools; + + /** + * Gets the DataPoolsClient object to access its operations. + * + * @return the DataPoolsClient object. + */ + public DataPoolsClient getDataPools() { + return this.dataPools; + } + + /** + * Initializes an instance of AdpManagementClient 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. + */ + AdpManagementClientImpl( + 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-02-01-preview"; + this.operations = new OperationsClientImpl(this); + this.accounts = new AccountsClientImpl(this); + this.dataPools = new DataPoolsClientImpl(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/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/CheckNameAvailabilityResultImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 0000000000000..8c196878018d9 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.implementation; + +import com.azure.resourcemanager.adp.AdpManager; +import com.azure.resourcemanager.adp.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.adp.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.adp.models.CheckNameAvailabilityResult; + +public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { + private CheckNameAvailabilityResultInner innerObject; + + private final AdpManager serviceManager; + + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner innerObject, AdpManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private AdpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolImpl.java new file mode 100644 index 0000000000000..fff9338455064 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.adp.AdpManager; +import com.azure.resourcemanager.adp.fluent.models.DataPoolInner; +import com.azure.resourcemanager.adp.models.DataPool; +import com.azure.resourcemanager.adp.models.DataPoolLocation; +import com.azure.resourcemanager.adp.models.DataPoolPatch; +import com.azure.resourcemanager.adp.models.ProvisioningState; +import com.azure.resourcemanager.adp.models.SystemData; +import java.util.Collections; +import java.util.List; + +public final class DataPoolImpl implements DataPool, DataPool.Definition, DataPool.Update { + private DataPoolInner innerObject; + + private final AdpManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String dataPoolId() { + return this.innerModel().dataPoolId(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public DataPoolInner innerModel() { + return this.innerObject; + } + + private AdpManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String dataPoolName; + + private DataPoolPatch updateParameters; + + public DataPoolImpl withExistingAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public DataPool create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataPools() + .createOrUpdate(resourceGroupName, accountName, dataPoolName, this.innerModel(), Context.NONE); + return this; + } + + public DataPool create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataPools() + .createOrUpdate(resourceGroupName, accountName, dataPoolName, this.innerModel(), context); + return this; + } + + DataPoolImpl(String name, AdpManager serviceManager) { + this.innerObject = new DataPoolInner(); + this.serviceManager = serviceManager; + this.dataPoolName = name; + } + + public DataPoolImpl update() { + this.updateParameters = new DataPoolPatch(); + return this; + } + + public DataPool apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataPools() + .update(resourceGroupName, accountName, dataPoolName, updateParameters, Context.NONE); + return this; + } + + public DataPool apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataPools() + .update(resourceGroupName, accountName, dataPoolName, updateParameters, context); + return this; + } + + DataPoolImpl(DataPoolInner innerObject, AdpManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "accounts"); + this.dataPoolName = Utils.getValueFromIdByName(innerObject.id(), "dataPools"); + } + + public DataPool refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataPools() + .getWithResponse(resourceGroupName, accountName, dataPoolName, Context.NONE) + .getValue(); + return this; + } + + public DataPool refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataPools() + .getWithResponse(resourceGroupName, accountName, dataPoolName, context) + .getValue(); + return this; + } + + public DataPoolImpl withLocations(List locations) { + if (isInCreateMode()) { + this.innerModel().withLocations(locations); + return this; + } else { + this.updateParameters.withLocations(locations); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolsClientImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolsClientImpl.java new file mode 100644 index 0000000000000..32323c43d63cb --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolsClientImpl.java @@ -0,0 +1,1449 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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.adp.fluent.DataPoolsClient; +import com.azure.resourcemanager.adp.fluent.models.DataPoolInner; +import com.azure.resourcemanager.adp.models.DataPoolList; +import com.azure.resourcemanager.adp.models.DataPoolPatch; +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 DataPoolsClient. */ +public final class DataPoolsClientImpl implements DataPoolsClient { + private final ClientLogger logger = new ClientLogger(DataPoolsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DataPoolsService service; + + /** The service client containing this operation class. */ + private final AdpManagementClientImpl client; + + /** + * Initializes an instance of DataPoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataPoolsClientImpl(AdpManagementClientImpl client) { + this.service = + RestProxy.create(DataPoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdpManagementClientDataPools to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AdpManagementClientD") + private interface DataPoolsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("dataPoolName") String dataPoolName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("dataPoolName") String dataPoolName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DataPoolPatch parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("dataPoolName") String dataPoolName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DataPoolInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.AutonomousDevelopmentPlatform/accounts/{accountName}/dataPools/{dataPoolName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("dataPoolName") String dataPoolName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the data pools under the ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the data pools under the ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the data pools under the ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, accountName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the data pools under the ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, accountName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the data pools under the ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String accountName) { + return new PagedIterable<>(listAsync(resourceGroupName, accountName)); + } + + /** + * Lists the data pools under the ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the properties of a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String dataPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (dataPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + dataPoolName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the properties of a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String dataPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (dataPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + dataPoolName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the properties of a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, String dataPoolName) { + return getWithResponseAsync(resourceGroupName, accountName, dataPoolName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the properties of a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataPoolInner get(String resourceGroupName, String accountName, String dataPoolName) { + return getAsync(resourceGroupName, accountName, dataPoolName).block(); + } + + /** + * Gets the properties of a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String dataPoolName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, dataPoolName, context).block(); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (dataPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataPoolName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + dataPoolName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (dataPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataPoolName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + dataPoolName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DataPoolInner> beginUpdateAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, accountName, dataPoolName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DataPoolInner.class, DataPoolInner.class, Context.NONE); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DataPoolInner> beginUpdateAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, accountName, dataPoolName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DataPoolInner.class, DataPoolInner.class, context); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DataPoolInner> beginUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters) { + return beginUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters).getSyncPoller(); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DataPoolInner> beginUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters, Context context) { + return beginUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters, context).getSyncPoller(); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters) { + return beginUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String accountName, String dataPoolName) { + final DataPoolPatch parameters = null; + return beginUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters, Context context) { + return beginUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataPoolInner update( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters) { + return updateAsync(resourceGroupName, accountName, dataPoolName, parameters).block(); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataPoolInner update(String resourceGroupName, String accountName, String dataPoolName) { + final DataPoolPatch parameters = null; + return updateAsync(resourceGroupName, accountName, dataPoolName, parameters).block(); + } + + /** + * Updates the properties of an existing Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataPoolInner update( + String resourceGroupName, String accountName, String dataPoolName, DataPoolPatch parameters, Context context) { + return updateAsync(resourceGroupName, accountName, dataPoolName, parameters, context).block(); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (dataPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataPoolName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + dataPoolName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (dataPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataPoolName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + dataPoolName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DataPoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, dataPoolName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DataPoolInner.class, DataPoolInner.class, Context.NONE); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DataPoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, dataPoolName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DataPoolInner.class, DataPoolInner.class, context); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DataPoolInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DataPoolInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String accountName, String dataPoolName) { + final DataPoolInner parameters = null; + return beginCreateOrUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataPoolInner createOrUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters) { + return createOrUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters).block(); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataPoolInner createOrUpdate(String resourceGroupName, String accountName, String dataPoolName) { + final DataPoolInner parameters = null; + return createOrUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters).block(); + } + + /** + * Creates or updates a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param parameters The parameters to provide for the Data Pool. + * @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 aDP Data Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataPoolInner createOrUpdate( + String resourceGroupName, String accountName, String dataPoolName, DataPoolInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, accountName, dataPoolName, parameters, context).block(); + } + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, String dataPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (dataPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + dataPoolName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, String dataPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (dataPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + dataPoolName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName, dataPoolName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, dataPoolName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName) { + return beginDeleteAsync(resourceGroupName, accountName, dataPoolName).getSyncPoller(); + } + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, dataPoolName, context).getSyncPoller(); + } + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, String dataPoolName) { + return beginDeleteAsync(resourceGroupName, accountName, dataPoolName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, dataPoolName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, String dataPoolName) { + deleteAsync(resourceGroupName, accountName, dataPoolName).block(); + } + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName, Context context) { + deleteAsync(resourceGroupName, accountName, dataPoolName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolsImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolsImpl.java new file mode 100644 index 0000000000000..43e63826199f8 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/DataPoolsImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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.adp.AdpManager; +import com.azure.resourcemanager.adp.fluent.DataPoolsClient; +import com.azure.resourcemanager.adp.fluent.models.DataPoolInner; +import com.azure.resourcemanager.adp.models.DataPool; +import com.azure.resourcemanager.adp.models.DataPools; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DataPoolsImpl implements DataPools { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataPoolsImpl.class); + + private final DataPoolsClient innerClient; + + private final AdpManager serviceManager; + + public DataPoolsImpl(DataPoolsClient innerClient, AdpManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new DataPoolImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String accountName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new DataPoolImpl(inner1, this.manager())); + } + + public DataPool get(String resourceGroupName, String accountName, String dataPoolName) { + DataPoolInner inner = this.serviceClient().get(resourceGroupName, accountName, dataPoolName); + if (inner != null) { + return new DataPoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String dataPoolName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, dataPoolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataPoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String accountName, String dataPoolName) { + this.serviceClient().delete(resourceGroupName, accountName, dataPoolName); + } + + public void delete(String resourceGroupName, String accountName, String dataPoolName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, dataPoolName, context); + } + + public DataPool getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String dataPoolName = Utils.getValueFromIdByName(id, "dataPools"); + if (dataPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataPools'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, dataPoolName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String dataPoolName = Utils.getValueFromIdByName(id, "dataPools"); + if (dataPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataPools'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, dataPoolName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String dataPoolName = Utils.getValueFromIdByName(id, "dataPools"); + if (dataPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataPools'.", id))); + } + this.delete(resourceGroupName, accountName, dataPoolName, 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 accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String dataPoolName = Utils.getValueFromIdByName(id, "dataPools"); + if (dataPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataPools'.", id))); + } + this.delete(resourceGroupName, accountName, dataPoolName, context); + } + + private DataPoolsClient serviceClient() { + return this.innerClient; + } + + private AdpManager manager() { + return this.serviceManager; + } + + public DataPoolImpl define(String name) { + return new DataPoolImpl(name, this.manager()); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationImpl.java new file mode 100644 index 0000000000000..3ab8922e3555f --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.implementation; + +import com.azure.resourcemanager.adp.AdpManager; +import com.azure.resourcemanager.adp.fluent.models.OperationInner; +import com.azure.resourcemanager.adp.models.Operation; +import com.azure.resourcemanager.adp.models.OperationDisplay; +import com.azure.resourcemanager.adp.models.OperationServiceSpecification; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final AdpManager serviceManager; + + OperationImpl(OperationInner innerObject, AdpManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public String actionType() { + return this.innerModel().actionType(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public OperationServiceSpecification serviceSpecification() { + return this.innerModel().serviceSpecification(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private AdpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationsClientImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..3eaf25d108e9d --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.adp.fluent.OperationsClient; +import com.azure.resourcemanager.adp.fluent.models.OperationInner; +import com.azure.resourcemanager.adp.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final AdpManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AdpManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdpManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AdpManagementClientO") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.AutonomousDevelopmentPlatform/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available Autonomous Development Platform provider 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the available Autonomous Development Platform provider 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available Autonomous Development Platform provider 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Autonomous Development Platform provider 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available Autonomous Development Platform provider 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available Autonomous Development Platform provider 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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationsImpl.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..bf0b7989b5b3f --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.adp.AdpManager; +import com.azure.resourcemanager.adp.fluent.OperationsClient; +import com.azure.resourcemanager.adp.fluent.models.OperationInner; +import com.azure.resourcemanager.adp.models.Operation; +import com.azure.resourcemanager.adp.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final AdpManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, AdpManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private AdpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/Utils.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/Utils.java new file mode 100644 index 0000000000000..698b211459874 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/Utils.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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.Mono; + +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 pageIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pageIterable, Function mapper) { + super(new PagedFlux(Mono::empty)); + this.pageIterable = pageIterable; + this.mapper = mapper; + this.pageMapper = + 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 pageIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pageIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pageIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pageIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pageIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pageIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pageIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.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/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/package-info.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/implementation/package-info.java new file mode 100644 index 0000000000000..185bcf6bad42b --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/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 AdpManagementClient. Microsoft Autonomous Development Platform. */ +package com.azure.resourcemanager.adp.implementation; diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Account.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Account.java new file mode 100644 index 0000000000000..9b376cdff48de --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Account.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.adp.fluent.models.AccountInner; +import java.util.Map; + +/** An immutable client-side representation of Account. */ +public interface Account { + /** + * 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 systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the accountId property: The account's data-plane ID. + * + * @return the accountId value. + */ + String accountId(); + + /** + * Gets the provisioningState property: Gets the status of the account at the time the operation was called. + * + * @return the provisioningState value. + */ + ProvisioningState 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.adp.fluent.models.AccountInner object. + * + * @return the inner object. + */ + AccountInner innerModel(); + + /** The entirety of the Account definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Account definition stages. */ + interface DefinitionStages { + /** The first stage of the Account definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Account 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 Account 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 Account definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + Account create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Account create(Context context); + } + /** The stage of the Account definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Begins update for the Account resource. + * + * @return the stage of resource update. + */ + Account.Update update(); + + /** The template for Account update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Account apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Account apply(Context context); + } + /** The Account update stages. */ + interface UpdateStages { + /** The stage of the Account update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Account refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Account refresh(Context context); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountCheckNameAvailabilityParameters.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountCheckNameAvailabilityParameters.java new file mode 100644 index 0000000000000..87d14bc19f6df --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountCheckNameAvailabilityParameters.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The parameters used to check the availability of the account name. */ +@Fluent +public final class AccountCheckNameAvailabilityParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountCheckNameAvailabilityParameters.class); + + /* + * The account name + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The type of resource, Microsoft.AutonomousDevelopmentPlatform/accounts + */ + @JsonProperty(value = "type", required = true) + private Type type; + + /** + * Get the name property: The account name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The account name. + * + * @param name the name value to set. + * @return the AccountCheckNameAvailabilityParameters object itself. + */ + public AccountCheckNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type of resource, Microsoft.AutonomousDevelopmentPlatform/accounts. + * + * @return the type value. + */ + public Type type() { + return this.type; + } + + /** + * Set the type property: The type of resource, Microsoft.AutonomousDevelopmentPlatform/accounts. + * + * @param type the type value to set. + * @return the AccountCheckNameAvailabilityParameters object itself. + */ + public AccountCheckNameAvailabilityParameters withType(Type type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model AccountCheckNameAvailabilityParameters")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model AccountCheckNameAvailabilityParameters")); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountList.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountList.java new file mode 100644 index 0000000000000..56a70336e04b1 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.adp.fluent.models.AccountInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list operation response, that contains the data pools and their properties. */ +@Fluent +public final class AccountList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountList.class); + + /* + * List of accounts and their properties + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results if there are any + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of accounts and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the AccountList object itself. + */ + public AccountList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountPatch.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountPatch.java new file mode 100644 index 0000000000000..2bf0e72f79646 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/AccountPatch.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.adp.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; +import java.util.Map; + +/** ADP account. */ +@JsonFlatten +@Immutable +public class AccountPatch extends Tags { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountPatch.class); + + /* + * The account's data-plane ID + */ + @JsonProperty(value = "properties.accountId", access = JsonProperty.Access.WRITE_ONLY) + private String accountId; + + /* + * Gets the status of the account at the time the operation was called + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the accountId property: The account's data-plane ID. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the provisioningState property: Gets the status of the account at the time the operation was called. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** {@inheritDoc} */ + @Override + public AccountPatch withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Accounts.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Accounts.java new file mode 100644 index 0000000000000..106cb6ffb4aa0 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Accounts.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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 Accounts. */ +public interface Accounts { + /** + * Checks that the account name is valid and is not already in use. + * + * @param parameters The checkNameAvailability parameters. + * @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 checkNameAvailability operation response. + */ + CheckNameAvailabilityResult checkNameAvailability(AccountCheckNameAvailabilityParameters parameters); + + /** + * Checks that the account name is valid and is not already in use. + * + * @param parameters The checkNameAvailability parameters. + * @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 checkNameAvailability operation response. + */ + Response checkNameAvailabilityWithResponse( + AccountCheckNameAvailabilityParameters parameters, Context context); + + /** + * List all ADP accounts available under the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + PagedIterable list(); + + /** + * List all ADP accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + PagedIterable list(Context context); + + /** + * List all ADP accounts available under the resource group. + * + * @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 the list operation response, that contains the data pools and their properties. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all ADP accounts available under the resource group. + * + * @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 the list operation response, that contains the data pools and their properties. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the properties of an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + Account getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Gets the properties of an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String accountName); + + /** + * Deletes an ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, Context context); + + /** + * Gets the properties of an ADP account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + Account getById(String id); + + /** + * Gets the properties of an ADP account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an ADP account. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an ADP account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an ADP account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Account resource. + * + * @param name resource name. + * @return the first stage of the new Account definition. + */ + Account.DefinitionStages.Blank define(String name); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CheckNameAvailabilityReason.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..85c44bc28feb6 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CheckNameAvailabilityReason.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.adp.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CheckNameAvailabilityReason. */ +public final class CheckNameAvailabilityReason extends ExpandableStringEnum { + /** Static value Invalid for CheckNameAvailabilityReason. */ + public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for CheckNameAvailabilityReason. */ + public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a CheckNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameAvailabilityReason. + */ + @JsonCreator + public static CheckNameAvailabilityReason fromString(String name) { + return fromString(name, CheckNameAvailabilityReason.class); + } + + /** @return known CheckNameAvailabilityReason values. */ + public static Collection values() { + return values(CheckNameAvailabilityReason.class); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CheckNameAvailabilityResult.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CheckNameAvailabilityResult.java new file mode 100644 index 0000000000000..1a203168a0cff --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CheckNameAvailabilityResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.resourcemanager.adp.fluent.models.CheckNameAvailabilityResultInner; + +/** An immutable client-side representation of CheckNameAvailabilityResult. */ +public interface CheckNameAvailabilityResult { + /** + * Gets the nameAvailable property: Gets a boolean value that indicates whether the name is available for you to + * use. If true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: Gets the reason that an account name could not be used. The reason element is only + * returned if nameAvailable is false. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: Gets an error message explaining the reason value in more detail. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.adp.fluent.models.CheckNameAvailabilityResultInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CreatedByType.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CreatedByType.java new file mode 100644 index 0000000000000..c30b3f25a7458 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/CreatedByType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreatedByType. */ +public final class CreatedByType extends ExpandableStringEnum { + /** Static value User for CreatedByType. */ + public static final CreatedByType USER = fromString("User"); + + /** Static value Application for CreatedByType. */ + public static final CreatedByType APPLICATION = fromString("Application"); + + /** Static value ManagedIdentity for CreatedByType. */ + public static final CreatedByType MANAGED_IDENTITY = fromString("ManagedIdentity"); + + /** Static value Key for CreatedByType. */ + public static final CreatedByType KEY = fromString("Key"); + + /** + * Creates or finds a CreatedByType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreatedByType. + */ + @JsonCreator + public static CreatedByType fromString(String name) { + return fromString(name, CreatedByType.class); + } + + /** @return known CreatedByType values. */ + public static Collection values() { + return values(CreatedByType.class); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPool.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPool.java new file mode 100644 index 0000000000000..10e248ee864e7 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPool.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.adp.fluent.models.DataPoolInner; +import java.util.List; + +/** An immutable client-side representation of DataPool. */ +public interface DataPool { + /** + * 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 dataPoolId property: The Data Pool's data-plane ID. + * + * @return the dataPoolId value. + */ + String dataPoolId(); + + /** + * Gets the provisioningState property: Gets the status of the data pool at the time the operation was called. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the locations property: Gets or sets the collection of locations where Data Pool resources should be + * created. + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.adp.fluent.models.DataPoolInner object. + * + * @return the inner object. + */ + DataPoolInner innerModel(); + + /** The entirety of the DataPool definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DataPool definition stages. */ + interface DefinitionStages { + /** The first stage of the DataPool definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DataPool definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @return the next definition stage. + */ + WithCreate withExistingAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the DataPool 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.WithLocations { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataPool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataPool create(Context context); + } + /** The stage of the DataPool definition allowing to specify locations. */ + interface WithLocations { + /** + * Specifies the locations property: Gets or sets the collection of locations where Data Pool resources + * should be created. + * + * @param locations Gets or sets the collection of locations where Data Pool resources should be created. + * @return the next definition stage. + */ + WithCreate withLocations(List locations); + } + } + /** + * Begins update for the DataPool resource. + * + * @return the stage of resource update. + */ + DataPool.Update update(); + + /** The template for DataPool update. */ + interface Update extends UpdateStages.WithLocations { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataPool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataPool apply(Context context); + } + /** The DataPool update stages. */ + interface UpdateStages { + /** The stage of the DataPool update allowing to specify locations. */ + interface WithLocations { + /** + * Specifies the locations property: Gets or sets the collection of locations where Data Pool resources + * should be created. + * + * @param locations Gets or sets the collection of locations where Data Pool resources should be created. + * @return the next definition stage. + */ + Update withLocations(List locations); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataPool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataPool refresh(Context context); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolBaseProperties.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolBaseProperties.java new file mode 100644 index 0000000000000..83e4a862d7536 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolBaseProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Data Pool properties. */ +@Fluent +public class DataPoolBaseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataPoolBaseProperties.class); + + /* + * The Data Pool's data-plane ID + */ + @JsonProperty(value = "dataPoolId", access = JsonProperty.Access.WRITE_ONLY) + private String dataPoolId; + + /* + * Gets the status of the data pool at the time the operation was called + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Gets or sets the collection of locations where Data Pool resources + * should be created + */ + @JsonProperty(value = "locations") + private List locations; + + /* + * The system meta data relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the dataPoolId property: The Data Pool's data-plane ID. + * + * @return the dataPoolId value. + */ + public String dataPoolId() { + return this.dataPoolId; + } + + /** + * Get the provisioningState property: Gets the status of the data pool at the time the operation was called. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the locations property: Gets or sets the collection of locations where Data Pool resources should be created. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: Gets or sets the collection of locations where Data Pool resources should be created. + * + * @param locations the locations value to set. + * @return the DataPoolBaseProperties object itself. + */ + public DataPoolBaseProperties withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + if (systemData() != null) { + systemData().validate(); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolEncryption.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolEncryption.java new file mode 100644 index 0000000000000..f545a6a91c703 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolEncryption.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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; + +/** Encryption properties of a Data Pool. */ +@Fluent +public final class DataPoolEncryption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataPoolEncryption.class); + + /* + * The URI of a soft delete-enabled Key Vault that is in the same location + * as the Data Pool location + */ + @JsonProperty(value = "keyVaultUri", required = true) + private String keyVaultUri; + + /* + * The name of Key Vault key + */ + @JsonProperty(value = "keyName", required = true) + private String keyName; + + /* + * The version of Key Vault key + */ + @JsonProperty(value = "keyVersion") + private String keyVersion; + + /* + * The resource ID of a user-assigned Managed Identity used to access the + * encryption key in the Key Vault. Requires access to the key operations + * get, wrap, unwrap, and recover + */ + @JsonProperty(value = "userAssignedIdentity", required = true) + private String userAssignedIdentity; + + /** + * Get the keyVaultUri property: The URI of a soft delete-enabled Key Vault that is in the same location as the Data + * Pool location. + * + * @return the keyVaultUri value. + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the keyVaultUri property: The URI of a soft delete-enabled Key Vault that is in the same location as the Data + * Pool location. + * + * @param keyVaultUri the keyVaultUri value to set. + * @return the DataPoolEncryption object itself. + */ + public DataPoolEncryption withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Get the keyName property: The name of Key Vault key. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: The name of Key Vault key. + * + * @param keyName the keyName value to set. + * @return the DataPoolEncryption object itself. + */ + public DataPoolEncryption withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the keyVersion property: The version of Key Vault key. + * + * @return the keyVersion value. + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set the keyVersion property: The version of Key Vault key. + * + * @param keyVersion the keyVersion value to set. + * @return the DataPoolEncryption object itself. + */ + public DataPoolEncryption withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * Get the userAssignedIdentity property: The resource ID of a user-assigned Managed Identity used to access the + * encryption key in the Key Vault. Requires access to the key operations get, wrap, unwrap, and recover. + * + * @return the userAssignedIdentity value. + */ + public String userAssignedIdentity() { + return this.userAssignedIdentity; + } + + /** + * Set the userAssignedIdentity property: The resource ID of a user-assigned Managed Identity used to access the + * encryption key in the Key Vault. Requires access to the key operations get, wrap, unwrap, and recover. + * + * @param userAssignedIdentity the userAssignedIdentity value to set. + * @return the DataPoolEncryption object itself. + */ + public DataPoolEncryption withUserAssignedIdentity(String userAssignedIdentity) { + this.userAssignedIdentity = userAssignedIdentity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyVaultUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyVaultUri in model DataPoolEncryption")); + } + if (keyName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyName in model DataPoolEncryption")); + } + if (userAssignedIdentity() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property userAssignedIdentity in model DataPoolEncryption")); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolList.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolList.java new file mode 100644 index 0000000000000..c756827ada63e --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.adp.fluent.models.DataPoolInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list operation response, that contains the data pools and their properties. */ +@Fluent +public final class DataPoolList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataPoolList.class); + + /* + * List of data pools and their properties + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results if there are any + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of data pools and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the DataPoolList object itself. + */ + public DataPoolList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolLocation.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolLocation.java new file mode 100644 index 0000000000000..0181b64f948c6 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolLocation.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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; + +/** Location of a Data Pool. */ +@Fluent +public final class DataPoolLocation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataPoolLocation.class); + + /* + * The location name + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Encryption properties of a Data Pool location + */ + @JsonProperty(value = "encryption") + private DataPoolEncryption encryption; + + /** + * Get the name property: The location name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The location name. + * + * @param name the name value to set. + * @return the DataPoolLocation object itself. + */ + public DataPoolLocation withName(String name) { + this.name = name; + return this; + } + + /** + * Get the encryption property: Encryption properties of a Data Pool location. + * + * @return the encryption value. + */ + public DataPoolEncryption encryption() { + return this.encryption; + } + + /** + * Set the encryption property: Encryption properties of a Data Pool location. + * + * @param encryption the encryption value to set. + * @return the DataPoolLocation object itself. + */ + public DataPoolLocation withEncryption(DataPoolEncryption encryption) { + this.encryption = encryption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model DataPoolLocation")); + } + if (encryption() != null) { + encryption().validate(); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolPatch.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolPatch.java new file mode 100644 index 0000000000000..ac91ef34b21c6 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolPatch.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** ADP Data Pool. */ +@JsonFlatten +@Fluent +public class DataPoolPatch extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataPoolPatch.class); + + /* + * The Data Pool's data-plane ID + */ + @JsonProperty(value = "properties.dataPoolId", access = JsonProperty.Access.WRITE_ONLY) + private String dataPoolId; + + /* + * Gets the status of the data pool at the time the operation was called + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Gets or sets the collection of locations where Data Pool resources + * should be created + */ + @JsonProperty(value = "properties.locations") + private List locations; + + /* + * The system meta data relating to this resource + */ + @JsonProperty(value = "properties.systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the dataPoolId property: The Data Pool's data-plane ID. + * + * @return the dataPoolId value. + */ + public String dataPoolId() { + return this.dataPoolId; + } + + /** + * Get the provisioningState property: Gets the status of the data pool at the time the operation was called. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the locations property: Gets or sets the collection of locations where Data Pool resources should be created. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: Gets or sets the collection of locations where Data Pool resources should be created. + * + * @param locations the locations value to set. + * @return the DataPoolPatch object itself. + */ + public DataPoolPatch withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + if (systemData() != null) { + systemData().validate(); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolProperties.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolProperties.java new file mode 100644 index 0000000000000..0f63fffdc025f --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPoolProperties.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.List; + +/** Data Pool properties. */ +@Immutable +public final class DataPoolProperties extends DataPoolBaseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataPoolProperties.class); + + /** {@inheritDoc} */ + @Override + public DataPoolProperties withLocations(List locations) { + super.withLocations(locations); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPools.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPools.java new file mode 100644 index 0000000000000..cf13df1fab09b --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/DataPools.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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 DataPools. */ +public interface DataPools { + /** + * Lists the data pools under the ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + PagedIterable list(String resourceGroupName, String accountName); + + /** + * Lists the data pools under the ADP account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + PagedIterable list(String resourceGroupName, String accountName, Context context); + + /** + * Gets the properties of a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a Data Pool. + */ + DataPool get(String resourceGroupName, String accountName, String dataPoolName); + + /** + * Gets the properties of a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a Data Pool. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String dataPoolName, Context context); + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName); + + /** + * Deletes a Data Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the ADP account. + * @param dataPoolName The name of the Data Pool. + * @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 accountName, String dataPoolName, Context context); + + /** + * Gets the properties of a Data Pool. + * + * @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 properties of a Data Pool. + */ + DataPool getById(String id); + + /** + * Gets the properties of a Data Pool. + * + * @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 properties of a Data Pool. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a Data Pool. + * + * @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 a Data Pool. + * + * @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 DataPool resource. + * + * @param name resource name. + * @return the first stage of the new DataPool definition. + */ + DataPool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Operation.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Operation.java new file mode 100644 index 0000000000000..d0c4ac9926bd7 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Operation.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.adp.models; + +import com.azure.resourcemanager.adp.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the actionType property: Indicates the action type. + * + * @return the actionType value. + */ + String actionType(); + + /** + * Gets the display property: Display of the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: Origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the serviceSpecification property: Details about a service operation. + * + * @return the serviceSpecification value. + */ + OperationServiceSpecification serviceSpecification(); + + /** + * Gets the inner com.azure.resourcemanager.adp.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationDisplay.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationDisplay.java new file mode 100644 index 0000000000000..862782c5feb59 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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; + +/** Operation display payload. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Resource provider of the operation + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource of the operation + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Localized friendly name for the operation + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Localized friendly description for the operation + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Resource provider of the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Resource provider of the operation. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource of the operation. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource of the operation. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Localized friendly name for the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Localized friendly name for the operation. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Localized friendly description for the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Localized friendly description for the operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationListResult.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationListResult.java new file mode 100644 index 0000000000000..fa90299ac1134 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.adp.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Available operations of the service. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of operations supported by the Resource Provider + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of operations supported by the Resource Provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the Resource Provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationLogSpecification.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationLogSpecification.java new file mode 100644 index 0000000000000..31cd9f89d0a85 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationLogSpecification.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.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; + +/** Details about an operation related to logs. */ +@Fluent +public final class OperationLogSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationLogSpecification.class); + + /* + * The name of the log category + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized display name + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Blobs created in the customer storage account, per hour + */ + @JsonProperty(value = "blobDuration") + private String blobDuration; + + /** + * Get the name property: The name of the log category. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the log category. + * + * @param name the name value to set. + * @return the OperationLogSpecification object itself. + */ + public OperationLogSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized display name. + * + * @param displayName the displayName value to set. + * @return the OperationLogSpecification object itself. + */ + public OperationLogSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the blobDuration property: Blobs created in the customer storage account, per hour. + * + * @return the blobDuration value. + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Set the blobDuration property: Blobs created in the customer storage account, per hour. + * + * @param blobDuration the blobDuration value to set. + * @return the OperationLogSpecification object itself. + */ + public OperationLogSpecification withBlobDuration(String blobDuration) { + this.blobDuration = blobDuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationMetricAvailability.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationMetricAvailability.java new file mode 100644 index 0000000000000..3e56be415e7c7 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationMetricAvailability.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.adp.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; + +/** Defines how often data for a metric becomes available. */ +@Fluent +public final class OperationMetricAvailability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationMetricAvailability.class); + + /* + * The granularity for the metric + */ + @JsonProperty(value = "timeGrain") + private String timeGrain; + + /* + * Blob created in the customer storage account, per hour + */ + @JsonProperty(value = "blobDuration") + private String blobDuration; + + /** + * Get the timeGrain property: The granularity for the metric. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Set the timeGrain property: The granularity for the metric. + * + * @param timeGrain the timeGrain value to set. + * @return the OperationMetricAvailability object itself. + */ + public OperationMetricAvailability withTimeGrain(String timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get the blobDuration property: Blob created in the customer storage account, per hour. + * + * @return the blobDuration value. + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Set the blobDuration property: Blob created in the customer storage account, per hour. + * + * @param blobDuration the blobDuration value to set. + * @return the OperationMetricAvailability object itself. + */ + public OperationMetricAvailability withBlobDuration(String blobDuration) { + this.blobDuration = blobDuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationMetricSpecification.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationMetricSpecification.java new file mode 100644 index 0000000000000..1d7c03340564a --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationMetricSpecification.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Details about an operation related to metrics. */ +@Fluent +public final class OperationMetricSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationMetricSpecification.class); + + /* + * The name of the metric + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized display name of the metric + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The description of the metric + */ + @JsonProperty(value = "displayDescription") + private String displayDescription; + + /* + * The unit that the metric is measured in + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * The type of metric aggregation + */ + @JsonProperty(value = "aggregationType") + private String aggregationType; + + /* + * Whether or not the service is using regional MDM accounts + */ + @JsonProperty(value = "enableRegionalMdmAccount") + private String enableRegionalMdmAccount; + + /* + * The name of the MDM account + */ + @JsonProperty(value = "sourceMdmAccount") + private String sourceMdmAccount; + + /* + * The name of the MDM namespace + */ + @JsonProperty(value = "sourceMdmNamespace") + private String sourceMdmNamespace; + + /* + * Defines how often data for metrics becomes available + */ + @JsonProperty(value = "availabilities") + private List availabilities; + + /** + * Get the name property: The name of the metric. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the metric. + * + * @param name the name value to set. + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized display name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized display name of the metric. + * + * @param displayName the displayName value to set. + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the displayDescription property: The description of the metric. + * + * @return the displayDescription value. + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Set the displayDescription property: The description of the metric. + * + * @param displayDescription the displayDescription value to set. + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + return this; + } + + /** + * Get the unit property: The unit that the metric is measured in. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: The unit that the metric is measured in. + * + * @param unit the unit value to set. + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the aggregationType property: The type of metric aggregation. + * + * @return the aggregationType value. + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Set the aggregationType property: The type of metric aggregation. + * + * @param aggregationType the aggregationType value to set. + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withAggregationType(String aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get the enableRegionalMdmAccount property: Whether or not the service is using regional MDM accounts. + * + * @return the enableRegionalMdmAccount value. + */ + public String enableRegionalMdmAccount() { + return this.enableRegionalMdmAccount; + } + + /** + * Set the enableRegionalMdmAccount property: Whether or not the service is using regional MDM accounts. + * + * @param enableRegionalMdmAccount the enableRegionalMdmAccount value to set. + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withEnableRegionalMdmAccount(String enableRegionalMdmAccount) { + this.enableRegionalMdmAccount = enableRegionalMdmAccount; + return this; + } + + /** + * Get the sourceMdmAccount property: The name of the MDM account. + * + * @return the sourceMdmAccount value. + */ + public String sourceMdmAccount() { + return this.sourceMdmAccount; + } + + /** + * Set the sourceMdmAccount property: The name of the MDM account. + * + * @param sourceMdmAccount the sourceMdmAccount value to set. + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withSourceMdmAccount(String sourceMdmAccount) { + this.sourceMdmAccount = sourceMdmAccount; + return this; + } + + /** + * Get the sourceMdmNamespace property: The name of the MDM namespace. + * + * @return the sourceMdmNamespace value. + */ + public String sourceMdmNamespace() { + return this.sourceMdmNamespace; + } + + /** + * Set the sourceMdmNamespace property: The name of the MDM namespace. + * + * @param sourceMdmNamespace the sourceMdmNamespace value to set. + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withSourceMdmNamespace(String sourceMdmNamespace) { + this.sourceMdmNamespace = sourceMdmNamespace; + return this; + } + + /** + * Get the availabilities property: Defines how often data for metrics becomes available. + * + * @return the availabilities value. + */ + public List availabilities() { + return this.availabilities; + } + + /** + * Set the availabilities property: Defines how often data for metrics becomes available. + * + * @param availabilities the availabilities value to set. + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withAvailabilities(List availabilities) { + this.availabilities = availabilities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (availabilities() != null) { + availabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationServiceSpecification.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationServiceSpecification.java new file mode 100644 index 0000000000000..dd20d3806221a --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/OperationServiceSpecification.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Details about a service operation. */ +@Fluent +public final class OperationServiceSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationServiceSpecification.class); + + /* + * Details about operations related to logs + */ + @JsonProperty(value = "logSpecifications") + private List logSpecifications; + + /* + * Details about operations related to metrics + */ + @JsonProperty(value = "metricSpecifications") + private List metricSpecifications; + + /** + * Get the logSpecifications property: Details about operations related to logs. + * + * @return the logSpecifications value. + */ + public List logSpecifications() { + return this.logSpecifications; + } + + /** + * Set the logSpecifications property: Details about operations related to logs. + * + * @param logSpecifications the logSpecifications value to set. + * @return the OperationServiceSpecification object itself. + */ + public OperationServiceSpecification withLogSpecifications(List logSpecifications) { + this.logSpecifications = logSpecifications; + return this; + } + + /** + * Get the metricSpecifications property: Details about operations related to metrics. + * + * @return the metricSpecifications value. + */ + public List metricSpecifications() { + return this.metricSpecifications; + } + + /** + * Set the metricSpecifications property: Details about operations related to metrics. + * + * @param metricSpecifications the metricSpecifications value to set. + * @return the OperationServiceSpecification object itself. + */ + public OperationServiceSpecification withMetricSpecifications( + List metricSpecifications) { + this.metricSpecifications = metricSpecifications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logSpecifications() != null) { + logSpecifications().forEach(e -> e.validate()); + } + if (metricSpecifications() != null) { + metricSpecifications().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Operations.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Operations.java new file mode 100644 index 0000000000000..d927b716212dc --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available Autonomous Development Platform provider 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 available operations of the service. + */ + PagedIterable list(); + + /** + * Lists all of the available Autonomous Development Platform provider 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 available operations of the service. + */ + PagedIterable list(Context context); +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/ProvisioningState.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/ProvisioningState.java new file mode 100644 index 0000000000000..5114f03b46440 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/ProvisioningState.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Provisioning for ProvisioningState. */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/SystemData.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/SystemData.java new file mode 100644 index 0000000000000..975c0fe01a61d --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/SystemData.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Metadata pertaining to creation and last modification of the resource. */ +@Fluent +public final class SystemData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SystemData.class); + + /* + * The identity that created the resource. + */ + @JsonProperty(value = "createdBy") + private String createdBy; + + /* + * The type of identity that created the resource. + */ + @JsonProperty(value = "createdByType") + private CreatedByType createdByType; + + /* + * The timestamp of resource creation (UTC). + */ + @JsonProperty(value = "createdAt") + private OffsetDateTime createdAt; + + /* + * The identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedBy") + private String lastModifiedBy; + + /* + * The type of identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedByType") + private CreatedByType lastModifiedByType; + + /* + * The timestamp of resource last modification (UTC) + */ + @JsonProperty(value = "lastModifiedAt") + private OffsetDateTime lastModifiedAt; + + /** + * Get the createdBy property: The identity that created the resource. + * + * @return the createdBy value. + */ + public String createdBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: The identity that created the resource. + * + * @param createdBy the createdBy value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Get the createdByType property: The type of identity that created the resource. + * + * @return the createdByType value. + */ + public CreatedByType createdByType() { + return this.createdByType; + } + + /** + * Set the createdByType property: The type of identity that created the resource. + * + * @param createdByType the createdByType value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedByType(CreatedByType createdByType) { + this.createdByType = createdByType; + return this; + } + + /** + * Get the createdAt property: The timestamp of resource creation (UTC). + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: The timestamp of resource creation (UTC). + * + * @param createdAt the createdAt value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the lastModifiedBy property: The identity that last modified the resource. + * + * @return the lastModifiedBy value. + */ + public String lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Set the lastModifiedBy property: The identity that last modified the resource. + * + * @param lastModifiedBy the lastModifiedBy value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * Get the lastModifiedByType property: The type of identity that last modified the resource. + * + * @return the lastModifiedByType value. + */ + public CreatedByType lastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Set the lastModifiedByType property: The type of identity that last modified the resource. + * + * @param lastModifiedByType the lastModifiedByType value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedByType(CreatedByType lastModifiedByType) { + this.lastModifiedByType = lastModifiedByType; + return this; + } + + /** + * Get the lastModifiedAt property: The timestamp of resource last modification (UTC). + * + * @return the lastModifiedAt value. + */ + public OffsetDateTime lastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Set the lastModifiedAt property: The timestamp of resource last modification (UTC). + * + * @param lastModifiedAt the lastModifiedAt value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedAt(OffsetDateTime lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Tags.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Tags.java new file mode 100644 index 0000000000000..ca1700f1afcfb --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Tags.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Resource tags. */ +@Fluent +public class Tags { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Tags.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the Tags object itself. + */ + public Tags withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Type.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Type.java new file mode 100644 index 0000000000000..df832efce9e70 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/Type.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.adp.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Type. */ +public final class Type extends ExpandableStringEnum { + /** Static value Microsoft.AutonomousDevelopmentPlatform/accounts for Type. */ + public static final Type MICROSOFT_AUTONOMOUS_DEVELOPMENT_PLATFORM_ACCOUNTS = + fromString("Microsoft.AutonomousDevelopmentPlatform/accounts"); + + /** + * Creates or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + @JsonCreator + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** @return known Type values. */ + public static Collection values() { + return values(Type.class); + } +} diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/package-info.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/models/package-info.java new file mode 100644 index 0000000000000..66d491772927d --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/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 AdpManagementClient. Microsoft Autonomous Development Platform. */ +package com.azure.resourcemanager.adp.models; diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/package-info.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/package-info.java new file mode 100644 index 0000000000000..edb11c7c333d6 --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/src/main/java/com/azure/resourcemanager/adp/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 AdpManagementClient. Microsoft Autonomous Development Platform. */ +package com.azure.resourcemanager.adp; diff --git a/sdk/adp/azure-resourcemanager-adp/src/main/java/module-info.java b/sdk/adp/azure-resourcemanager-adp/src/main/java/module-info.java new file mode 100644 index 0000000000000..153f8b5d3bf7c --- /dev/null +++ b/sdk/adp/azure-resourcemanager-adp/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.adp { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.adp; + exports com.azure.resourcemanager.adp.fluent; + exports com.azure.resourcemanager.adp.fluent.models; + exports com.azure.resourcemanager.adp.models; + + opens com.azure.resourcemanager.adp.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.adp.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/adp/ci.yml b/sdk/adp/ci.yml new file mode 100644 index 0000000000000..8f8db3eca8b6a --- /dev/null +++ b/sdk/adp/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/adp/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/adp/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: adp + Artifacts: + - name: azure-resourcemanager-adp + groupId: com.azure.resourcemanager + safeName: azureresourcemanageradp diff --git a/sdk/adp/pom.xml b/sdk/adp/pom.xml new file mode 100644 index 0000000000000..23a6f64932795 --- /dev/null +++ b/sdk/adp/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-adp-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-adp + + + +