diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 9099899ed75d0..e4d9d5881011a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -331,6 +331,7 @@ com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;1.0.0-beta com.azure.resourcemanager:azure-resourcemanager-loadtestservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-automanage;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-edgeorder;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-azuredata;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/pom.xml b/pom.xml index aab77f33ebeb9..0988c273e2dfd 100644 --- a/pom.xml +++ b/pom.xml @@ -724,6 +724,7 @@ sdk/automation sdk/avs sdk/azurearcdata + sdk/azuredata sdk/azurestack sdk/azurestackhci sdk/baremetalinfrastructure diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/CHANGELOG.md b/sdk/azuredata/azure-resourcemanager-azuredata/CHANGELOG.md new file mode 100644 index 0000000000000..ee03cd2855d4b --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-01-05) + +- Azure Resource Manager AzureData client library for Java. This package contains Microsoft Azure SDK for AzureData Management SDK. The AzureData management API provides a RESTful set of web APIs to manage Azure Data Resources. Package tag package-preview-2019-07. 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/azuredata/azure-resourcemanager-azuredata/README.md b/sdk/azuredata/azure-resourcemanager-azuredata/README.md new file mode 100644 index 0000000000000..584cde8c81efc --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager AzureData client library for Java + +Azure Resource Manager AzureData client library for Java. + +This package contains Microsoft Azure SDK for AzureData Management SDK. The AzureData management API provides a RESTful set of web APIs to manage Azure Data Resources. Package tag package-preview-2019-07. 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-azuredata;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-azuredata + 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(); +AzureDataManager manager = AzureDataManager + .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 + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/azuredata/azure-resourcemanager-azuredata/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/SAMPLE.md b/sdk/azuredata/azure-resourcemanager-azuredata/SAMPLE.md new file mode 100644 index 0000000000000..99e15b89ced80 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/SAMPLE.md @@ -0,0 +1,303 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## SqlServerRegistrations + +- [CreateOrUpdate](#sqlserverregistrations_createorupdate) +- [Delete](#sqlserverregistrations_delete) +- [GetByResourceGroup](#sqlserverregistrations_getbyresourcegroup) +- [List](#sqlserverregistrations_list) +- [ListByResourceGroup](#sqlserverregistrations_listbyresourcegroup) +- [Update](#sqlserverregistrations_update) + +## SqlServers + +- [CreateOrUpdate](#sqlservers_createorupdate) +- [Delete](#sqlservers_delete) +- [Get](#sqlservers_get) +- [ListByResourceGroup](#sqlservers_listbyresourcegroup) +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/ListOperation.json + */ + /** + * Sample code: Lists all of the available SQL Server Registration API operations. + * + * @param manager Entry point to AzureDataManager. + */ + public static void listsAllOfTheAvailableSQLServerRegistrationAPIOperations( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### SqlServerRegistrations_CreateOrUpdate + +```java +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlServerRegistrations CreateOrUpdate. */ +public final class SqlServerRegistrationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/CreateOrUpdateSqlServerRegistration.json + */ + /** + * Sample code: Creates or updates a SQL Server registration. + * + * @param manager Entry point to AzureDataManager. + */ + public static void createsOrUpdatesASQLServerRegistration( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager + .sqlServerRegistrations() + .define("testsqlregistration") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withTags(mapOf("mytag", "myval")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerRegistrations_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SqlServerRegistrations Delete. */ +public final class SqlServerRegistrationsDeleteSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/DeleteSqlServerRegistration.json + */ + /** + * Sample code: Deletes a SQL Server registration. + * + * @param manager Entry point to AzureDataManager. + */ + public static void deletesASQLServerRegistration(com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServerRegistrations().deleteWithResponse("testrg", "testsqlregistration", Context.NONE); + } +} +``` + +### SqlServerRegistrations_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SqlServerRegistrations GetByResourceGroup. */ +public final class SqlServerRegistrationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/GetSqlServerRegistration.json + */ + /** + * Sample code: Gets a SQL Server registration. + * + * @param manager Entry point to AzureDataManager. + */ + public static void getsASQLServerRegistration(com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServerRegistrations().getByResourceGroupWithResponse("testrg", "testsqlregistration", Context.NONE); + } +} +``` + +### SqlServerRegistrations_List + +```java +import com.azure.core.util.Context; + +/** Samples for SqlServerRegistrations List. */ +public final class SqlServerRegistrationsListSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/ListSubscriptionSqlServerRegistration.json + */ + /** + * Sample code: Gets all SQL Server registrations in a subscription. + * + * @param manager Entry point to AzureDataManager. + */ + public static void getsAllSQLServerRegistrationsInASubscription( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServerRegistrations().list(Context.NONE); + } +} +``` + +### SqlServerRegistrations_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SqlServerRegistrations ListByResourceGroup. */ +public final class SqlServerRegistrationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/ListByResourceGroupSqlServerRegistration.json + */ + /** + * Sample code: Gets all SQL Server registrations in a resource group. + * + * @param manager Entry point to AzureDataManager. + */ + public static void getsAllSQLServerRegistrationsInAResourceGroup( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServerRegistrations().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### SqlServerRegistrations_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.azuredata.models.SqlServerRegistration; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlServerRegistrations Update. */ +public final class SqlServerRegistrationsUpdateSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/UpdateSqlServerRegistration.json + */ + /** + * Sample code: Updates a SQL Server Registration tags. + * + * @param manager Entry point to AzureDataManager. + */ + public static void updatesASQLServerRegistrationTags(com.azure.resourcemanager.azuredata.AzureDataManager manager) { + SqlServerRegistration resource = + manager + .sqlServerRegistrations() + .getByResourceGroupWithResponse("testrg", "testsqlregistration", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServers_CreateOrUpdate + +```java +/** Samples for SqlServers CreateOrUpdate. */ +public final class SqlServersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/CreateOrUpdateSqlServerWithRegistrationGroup.json + */ + /** + * Sample code: Creates or updates a SQL Server in a Registration group. + * + * @param manager Entry point to AzureDataManager. + */ + public static void createsOrUpdatesASQLServerInARegistrationGroup( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager + .sqlServers() + .define("testsqlserver") + .withExistingSqlServerRegistration("testrg", "testsqlregistration") + .withVersion("2008") + .withEdition("Latin") + .withRegistrationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureData/SqlServerRegistrations/testsqlregistration") + .withPropertyBag("") + .create(); + } +} +``` + +### SqlServers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SqlServers Delete. */ +public final class SqlServersDeleteSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/DeleteSqlServer.json + */ + /** + * Sample code: Deletes a SQL Server. + * + * @param manager Entry point to AzureDataManager. + */ + public static void deletesASQLServer(com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServers().deleteWithResponse("testrg", "testsqlregistration", "testsqlserver", Context.NONE); + } +} +``` + +### SqlServers_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SqlServers Get. */ +public final class SqlServersGetSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/GetSqlServer.json + */ + /** + * Sample code: Gets a SQL Server. + * + * @param manager Entry point to AzureDataManager. + */ + public static void getsASQLServer(com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServers().getWithResponse("testrg", "testsqlregistration", "testsqlserver", null, Context.NONE); + } +} +``` + +### SqlServers_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SqlServers ListByResourceGroup. */ +public final class SqlServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/ListByResourceGroupSqlServer.json + */ + /** + * Sample code: Gets all SQL Servers in a SQL Server Registration. + * + * @param manager Entry point to AzureDataManager. + */ + public static void getsAllSQLServersInASQLServerRegistration( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServers().listByResourceGroup("testrg", "testsqlregistration", null, Context.NONE); + } +} +``` + diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/pom.xml b/sdk/azuredata/azure-resourcemanager-azuredata/pom.xml new file mode 100644 index 0000000000000..9433c40b96a30 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/pom.xml @@ -0,0 +1,81 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-azuredata + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for AzureData Management + This package contains Microsoft Azure SDK for AzureData Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The AzureData management API provides a RESTful set of web APIs to manage Azure Data Resources. Package tag package-preview-2019-07. + 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 + true + false + + + + + + com.azure + azure-core + 1.23.1 + + + com.azure + azure-core-management + 1.4.4 + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/AzureDataManager.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/AzureDataManager.java new file mode 100644 index 0000000000000..00df6eaca4908 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/AzureDataManager.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata; + +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.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azuredata.fluent.AzureDataManagementClient; +import com.azure.resourcemanager.azuredata.implementation.AzureDataManagementClientBuilder; +import com.azure.resourcemanager.azuredata.implementation.OperationsImpl; +import com.azure.resourcemanager.azuredata.implementation.SqlServerRegistrationsImpl; +import com.azure.resourcemanager.azuredata.implementation.SqlServersImpl; +import com.azure.resourcemanager.azuredata.models.Operations; +import com.azure.resourcemanager.azuredata.models.SqlServerRegistrations; +import com.azure.resourcemanager.azuredata.models.SqlServers; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to AzureDataManager. The AzureData management API provides a RESTful set of web APIs to manage Azure Data + * Resources. + */ +public final class AzureDataManager { + private Operations operations; + + private SqlServerRegistrations sqlServerRegistrations; + + private SqlServers sqlServers; + + private final AzureDataManagementClient clientObject; + + private AzureDataManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AzureDataManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of AzureData service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the AzureData service API instance. + */ + public static AzureDataManager 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 AzureDataManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AzureDataManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of AzureData service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the AzureData service API instance. + */ + public AzureDataManager 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.azuredata") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new AzureDataManager(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 SqlServerRegistrations. */ + public SqlServerRegistrations sqlServerRegistrations() { + if (this.sqlServerRegistrations == null) { + this.sqlServerRegistrations = + new SqlServerRegistrationsImpl(clientObject.getSqlServerRegistrations(), this); + } + return sqlServerRegistrations; + } + + /** @return Resource collection API of SqlServers. */ + public SqlServers sqlServers() { + if (this.sqlServers == null) { + this.sqlServers = new SqlServersImpl(clientObject.getSqlServers(), this); + } + return sqlServers; + } + + /** + * @return Wrapped service client AzureDataManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public AzureDataManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/AzureDataManagementClient.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/AzureDataManagementClient.java new file mode 100644 index 0000000000000..5d51fec1ba16c --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/AzureDataManagementClient.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.azuredata.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AzureDataManagementClient class. */ +public interface AzureDataManagementClient { + /** + * Gets Subscription ID that identifies an Azure 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 SqlServerRegistrationsClient object to access its operations. + * + * @return the SqlServerRegistrationsClient object. + */ + SqlServerRegistrationsClient getSqlServerRegistrations(); + + /** + * Gets the SqlServersClient object to access its operations. + * + * @return the SqlServersClient object. + */ + SqlServersClient getSqlServers(); +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/OperationsClient.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/OperationsClient.java new file mode 100644 index 0000000000000..0abe4087575e9 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/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.azuredata.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.azuredata.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 SQL Server Registration API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available SQL Server Registration API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/SqlServerRegistrationsClient.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/SqlServerRegistrationsClient.java new file mode 100644 index 0000000000000..959190558897d --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/SqlServerRegistrationsClient.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerRegistrationInner; +import com.azure.resourcemanager.azuredata.models.SqlServerRegistrationUpdate; + +/** An instance of this class provides access to all the operations defined in SqlServerRegistrationsClient. */ +public interface SqlServerRegistrationsClient { + /** + * Gets a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerRegistrationInner getByResourceGroup(String resourceGroupName, String sqlServerRegistrationName); + + /** + * Gets a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String sqlServerRegistrationName, Context context); + + /** + * Creates or updates a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server registration to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerRegistrationInner createOrUpdate( + String resourceGroupName, String sqlServerRegistrationName, SqlServerRegistrationInner parameters); + + /** + * Creates or updates a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server registration to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String sqlServerRegistrationName, + SqlServerRegistrationInner parameters, + Context context); + + /** + * Deletes a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @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 sqlServerRegistrationName); + + /** + * Deletes a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String sqlServerRegistrationName, Context context); + + /** + * Updates SQL Server Registration tags. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server Registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerRegistrationInner update( + String resourceGroupName, String sqlServerRegistrationName, SqlServerRegistrationUpdate parameters); + + /** + * Updates SQL Server Registration tags. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server Registration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String sqlServerRegistrationName, + SqlServerRegistrationUpdate parameters, + Context context); + + /** + * Gets all SQL Server registrations in a resource group. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all SQL Server registrations in a resource group. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all SQL Server registrations in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all SQL Server registrations in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/SqlServersClient.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/SqlServersClient.java new file mode 100644 index 0000000000000..10462e3f71900 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/SqlServersClient.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerInner; + +/** An instance of this class provides access to all the operations defined in SqlServersClient. */ +public interface SqlServersClient { + /** + * Gets a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInner get(String resourceGroupName, String sqlServerRegistrationName, String sqlServerName); + + /** + * Gets a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String sqlServerRegistrationName, + String sqlServerName, + String expand, + Context context); + + /** + * Creates or updates a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param parameters The SQL Server to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInner createOrUpdate( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName, SqlServerInner parameters); + + /** + * Creates or updates a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param parameters The SQL Server to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String sqlServerRegistrationName, + String sqlServerName, + SqlServerInner parameters, + Context context); + + /** + * Deletes a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @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 sqlServerRegistrationName, String sqlServerName); + + /** + * Deletes a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName, Context context); + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String sqlServerRegistrationName); + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, String sqlServerRegistrationName, String expand, Context context); +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/OperationInner.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..795bd47884703 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/OperationInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azuredata.models.OperationDisplay; +import com.azure.resourcemanager.azuredata.models.OperationOrigin; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** SQL REST API operation definition. */ +@Immutable +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The localized display information for this particular operation / + * action. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /* + * The intended executor of the operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /* + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /** + * Get the name property: The name of the operation being performed on this particular object. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The localized display information for this particular operation / action. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + public OperationOrigin origin() { + return this.origin; + } + + /** + * Get the properties property: Additional descriptions for the operation. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerInner.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerInner.java new file mode 100644 index 0000000000000..e80fb6ee97f4a --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerInner.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A SQL server. */ +@Fluent +public final class SqlServerInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlServerInner.class); + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SqlServerProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SqlServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the cores property: Cores of the Sql Server. + * + * @return the cores value. + */ + public Integer cores() { + return this.innerProperties() == null ? null : this.innerProperties().cores(); + } + + /** + * Set the cores property: Cores of the Sql Server. + * + * @param cores the cores value to set. + * @return the SqlServerInner object itself. + */ + public SqlServerInner withCores(Integer cores) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlServerProperties(); + } + this.innerProperties().withCores(cores); + return this; + } + + /** + * Get the version property: Version of the Sql Server. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: Version of the Sql Server. + * + * @param version the version value to set. + * @return the SqlServerInner object itself. + */ + public SqlServerInner withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlServerProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the edition property: Sql Server Edition. + * + * @return the edition value. + */ + public String edition() { + return this.innerProperties() == null ? null : this.innerProperties().edition(); + } + + /** + * Set the edition property: Sql Server Edition. + * + * @param edition the edition value to set. + * @return the SqlServerInner object itself. + */ + public SqlServerInner withEdition(String edition) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlServerProperties(); + } + this.innerProperties().withEdition(edition); + return this; + } + + /** + * Get the registrationId property: ID for Parent Sql Server Registration. + * + * @return the registrationId value. + */ + public String registrationId() { + return this.innerProperties() == null ? null : this.innerProperties().registrationId(); + } + + /** + * Set the registrationId property: ID for Parent Sql Server Registration. + * + * @param registrationId the registrationId value to set. + * @return the SqlServerInner object itself. + */ + public SqlServerInner withRegistrationId(String registrationId) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlServerProperties(); + } + this.innerProperties().withRegistrationId(registrationId); + return this; + } + + /** + * Get the propertyBag property: Sql Server Json Property Bag. + * + * @return the propertyBag value. + */ + public String propertyBag() { + return this.innerProperties() == null ? null : this.innerProperties().propertyBag(); + } + + /** + * Set the propertyBag property: Sql Server Json Property Bag. + * + * @param propertyBag the propertyBag value to set. + * @return the SqlServerInner object itself. + */ + public SqlServerInner withPropertyBag(String propertyBag) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlServerProperties(); + } + this.innerProperties().withPropertyBag(propertyBag); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerProperties.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerProperties.java new file mode 100644 index 0000000000000..7a816a3b88dde --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerProperties.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SQL server properties. */ +@Fluent +public final class SqlServerProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlServerProperties.class); + + /* + * Cores of the Sql Server. + */ + @JsonProperty(value = "cores") + private Integer cores; + + /* + * Version of the Sql Server. + */ + @JsonProperty(value = "version") + private String version; + + /* + * Sql Server Edition. + */ + @JsonProperty(value = "edition") + private String edition; + + /* + * ID for Parent Sql Server Registration. + */ + @JsonProperty(value = "registrationID") + private String registrationId; + + /* + * Sql Server Json Property Bag. + */ + @JsonProperty(value = "propertyBag") + private String propertyBag; + + /** + * Get the cores property: Cores of the Sql Server. + * + * @return the cores value. + */ + public Integer cores() { + return this.cores; + } + + /** + * Set the cores property: Cores of the Sql Server. + * + * @param cores the cores value to set. + * @return the SqlServerProperties object itself. + */ + public SqlServerProperties withCores(Integer cores) { + this.cores = cores; + return this; + } + + /** + * Get the version property: Version of the Sql Server. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version of the Sql Server. + * + * @param version the version value to set. + * @return the SqlServerProperties object itself. + */ + public SqlServerProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the edition property: Sql Server Edition. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Set the edition property: Sql Server Edition. + * + * @param edition the edition value to set. + * @return the SqlServerProperties object itself. + */ + public SqlServerProperties withEdition(String edition) { + this.edition = edition; + return this; + } + + /** + * Get the registrationId property: ID for Parent Sql Server Registration. + * + * @return the registrationId value. + */ + public String registrationId() { + return this.registrationId; + } + + /** + * Set the registrationId property: ID for Parent Sql Server Registration. + * + * @param registrationId the registrationId value to set. + * @return the SqlServerProperties object itself. + */ + public SqlServerProperties withRegistrationId(String registrationId) { + this.registrationId = registrationId; + return this; + } + + /** + * Get the propertyBag property: Sql Server Json Property Bag. + * + * @return the propertyBag value. + */ + public String propertyBag() { + return this.propertyBag; + } + + /** + * Set the propertyBag property: Sql Server Json Property Bag. + * + * @param propertyBag the propertyBag value to set. + * @return the SqlServerProperties object itself. + */ + public SqlServerProperties withPropertyBag(String propertyBag) { + this.propertyBag = propertyBag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerRegistrationInner.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerRegistrationInner.java new file mode 100644 index 0000000000000..0888d7fc04868 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerRegistrationInner.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A SQL server registration. */ +@Fluent +public final class SqlServerRegistrationInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlServerRegistrationInner.class); + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SqlServerRegistrationProperties innerProperties; + + /* + * Read only system data + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SqlServerRegistrationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Read only system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public SqlServerRegistrationInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlServerRegistrationInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the subscriptionId property: Subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().subscriptionId(); + } + + /** + * Set the subscriptionId property: Subscription Id. + * + * @param subscriptionId the subscriptionId value to set. + * @return the SqlServerRegistrationInner object itself. + */ + public SqlServerRegistrationInner withSubscriptionId(String subscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlServerRegistrationProperties(); + } + this.innerProperties().withSubscriptionId(subscriptionId); + return this; + } + + /** + * Get the resourceGroup property: Resource Group Name. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.innerProperties() == null ? null : this.innerProperties().resourceGroup(); + } + + /** + * Set the resourceGroup property: Resource Group Name. + * + * @param resourceGroup the resourceGroup value to set. + * @return the SqlServerRegistrationInner object itself. + */ + public SqlServerRegistrationInner withResourceGroup(String resourceGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlServerRegistrationProperties(); + } + this.innerProperties().withResourceGroup(resourceGroup); + return this; + } + + /** + * Get the propertyBag property: Optional Properties as JSON string. + * + * @return the propertyBag value. + */ + public String propertyBag() { + return this.innerProperties() == null ? null : this.innerProperties().propertyBag(); + } + + /** + * Set the propertyBag property: Optional Properties as JSON string. + * + * @param propertyBag the propertyBag value to set. + * @return the SqlServerRegistrationInner object itself. + */ + public SqlServerRegistrationInner withPropertyBag(String propertyBag) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlServerRegistrationProperties(); + } + this.innerProperties().withPropertyBag(propertyBag); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerRegistrationProperties.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerRegistrationProperties.java new file mode 100644 index 0000000000000..fddba0c9cbda5 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/SqlServerRegistrationProperties.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.azuredata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SQL server Registration properties. */ +@Fluent +public final class SqlServerRegistrationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlServerRegistrationProperties.class); + + /* + * Subscription Id + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * Resource Group Name + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /* + * Optional Properties as JSON string + */ + @JsonProperty(value = "propertyBag") + private String propertyBag; + + /** + * Get the subscriptionId property: Subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Subscription Id. + * + * @param subscriptionId the subscriptionId value to set. + * @return the SqlServerRegistrationProperties object itself. + */ + public SqlServerRegistrationProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup property: Resource Group Name. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup property: Resource Group Name. + * + * @param resourceGroup the resourceGroup value to set. + * @return the SqlServerRegistrationProperties object itself. + */ + public SqlServerRegistrationProperties withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get the propertyBag property: Optional Properties as JSON string. + * + * @return the propertyBag value. + */ + public String propertyBag() { + return this.propertyBag; + } + + /** + * Set the propertyBag property: Optional Properties as JSON string. + * + * @param propertyBag the propertyBag value to set. + * @return the SqlServerRegistrationProperties object itself. + */ + public SqlServerRegistrationProperties withPropertyBag(String propertyBag) { + this.propertyBag = propertyBag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/package-info.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/package-info.java new file mode 100644 index 0000000000000..31179836fc8ff --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for AzureDataManagementClient. The AzureData management API provides a + * RESTful set of web APIs to manage Azure Data Resources. + */ +package com.azure.resourcemanager.azuredata.fluent.models; diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/package-info.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/package-info.java new file mode 100644 index 0000000000000..febf9fa7c1821 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for AzureDataManagementClient. The AzureData management API provides a RESTful + * set of web APIs to manage Azure Data Resources. + */ +package com.azure.resourcemanager.azuredata.fluent; diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/AzureDataManagementClientBuilder.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/AzureDataManagementClientBuilder.java new file mode 100644 index 0000000000000..6da744e9954d4 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/AzureDataManagementClientBuilder.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.azuredata.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 AzureDataManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {AzureDataManagementClientImpl.class}) +public final class AzureDataManagementClientBuilder { + /* + * Subscription ID that identifies an Azure subscription. + */ + private String subscriptionId; + + /** + * Sets Subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the AzureDataManagementClientBuilder. + */ + public AzureDataManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AzureDataManagementClientBuilder. + */ + public AzureDataManagementClientBuilder 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 AzureDataManagementClientBuilder. + */ + public AzureDataManagementClientBuilder 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 AzureDataManagementClientBuilder. + */ + public AzureDataManagementClientBuilder 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 AzureDataManagementClientBuilder. + */ + public AzureDataManagementClientBuilder 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 AzureDataManagementClientBuilder. + */ + public AzureDataManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AzureDataManagementClientImpl with the provided parameters. + * + * @return an instance of AzureDataManagementClientImpl. + */ + public AzureDataManagementClientImpl 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(); + } + AzureDataManagementClientImpl client = + new AzureDataManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/AzureDataManagementClientImpl.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/AzureDataManagementClientImpl.java new file mode 100644 index 0000000000000..7b2116b36e04b --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/AzureDataManagementClientImpl.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.azuredata.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.azuredata.fluent.AzureDataManagementClient; +import com.azure.resourcemanager.azuredata.fluent.OperationsClient; +import com.azure.resourcemanager.azuredata.fluent.SqlServerRegistrationsClient; +import com.azure.resourcemanager.azuredata.fluent.SqlServersClient; +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 AzureDataManagementClientImpl type. */ +@ServiceClient(builder = AzureDataManagementClientBuilder.class) +public final class AzureDataManagementClientImpl implements AzureDataManagementClient { + private final ClientLogger logger = new ClientLogger(AzureDataManagementClientImpl.class); + + /** Subscription ID that identifies an Azure subscription. */ + private final String subscriptionId; + + /** + * Gets Subscription ID that identifies an Azure 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 SqlServerRegistrationsClient object to access its operations. */ + private final SqlServerRegistrationsClient sqlServerRegistrations; + + /** + * Gets the SqlServerRegistrationsClient object to access its operations. + * + * @return the SqlServerRegistrationsClient object. + */ + public SqlServerRegistrationsClient getSqlServerRegistrations() { + return this.sqlServerRegistrations; + } + + /** The SqlServersClient object to access its operations. */ + private final SqlServersClient sqlServers; + + /** + * Gets the SqlServersClient object to access its operations. + * + * @return the SqlServersClient object. + */ + public SqlServersClient getSqlServers() { + return this.sqlServers; + } + + /** + * Initializes an instance of AzureDataManagementClient 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 Subscription ID that identifies an Azure subscription. + * @param endpoint server parameter. + */ + AzureDataManagementClientImpl( + 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 = "2019-07-24-preview"; + this.operations = new OperationsClientImpl(this); + this.sqlServerRegistrations = new SqlServerRegistrationsClientImpl(this); + this.sqlServers = new SqlServersClientImpl(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/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/OperationImpl.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/OperationImpl.java new file mode 100644 index 0000000000000..e4942fa4e074a --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/OperationImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.implementation; + +import com.azure.resourcemanager.azuredata.fluent.models.OperationInner; +import com.azure.resourcemanager.azuredata.models.Operation; +import com.azure.resourcemanager.azuredata.models.OperationDisplay; +import com.azure.resourcemanager.azuredata.models.OperationOrigin; +import java.util.Collections; +import java.util.Map; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.azuredata.AzureDataManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.azuredata.AzureDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationOrigin origin() { + return this.innerModel().origin(); + } + + public Map properties() { + Map inner = this.innerModel().properties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azuredata.AzureDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/OperationsClientImpl.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..c38250fab5827 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/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.azuredata.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.azuredata.fluent.OperationsClient; +import com.azure.resourcemanager.azuredata.fluent.models.OperationInner; +import com.azure.resourcemanager.azuredata.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 AzureDataManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AzureDataManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDataManagementClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDataManagementC") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.AzureData/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 SQL Server Registration API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available SQL Server Registration API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available SQL Server Registration API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available SQL Server Registration API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available SQL Server Registration API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available SQL Server Registration API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/OperationsImpl.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..e01e8740a09f9 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/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.azuredata.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.azuredata.fluent.OperationsClient; +import com.azure.resourcemanager.azuredata.fluent.models.OperationInner; +import com.azure.resourcemanager.azuredata.models.Operation; +import com.azure.resourcemanager.azuredata.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 com.azure.resourcemanager.azuredata.AzureDataManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.azuredata.AzureDataManager 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 com.azure.resourcemanager.azuredata.AzureDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerImpl.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerImpl.java new file mode 100644 index 0000000000000..adf5cbe4b5c97 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerInner; +import com.azure.resourcemanager.azuredata.models.SqlServer; + +public final class SqlServerImpl implements SqlServer, SqlServer.Definition, SqlServer.Update { + private SqlServerInner innerObject; + + private final com.azure.resourcemanager.azuredata.AzureDataManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer cores() { + return this.innerModel().cores(); + } + + public String version() { + return this.innerModel().version(); + } + + public String edition() { + return this.innerModel().edition(); + } + + public String registrationId() { + return this.innerModel().registrationId(); + } + + public String propertyBag() { + return this.innerModel().propertyBag(); + } + + public SqlServerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azuredata.AzureDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerRegistrationName; + + private String sqlServerName; + + public SqlServerImpl withExistingSqlServerRegistration(String resourceGroupName, String sqlServerRegistrationName) { + this.resourceGroupName = resourceGroupName; + this.sqlServerRegistrationName = sqlServerRegistrationName; + return this; + } + + public SqlServer create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServers() + .createOrUpdateWithResponse( + resourceGroupName, sqlServerRegistrationName, sqlServerName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlServer create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServers() + .createOrUpdateWithResponse( + resourceGroupName, sqlServerRegistrationName, sqlServerName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlServerImpl(String name, com.azure.resourcemanager.azuredata.AzureDataManager serviceManager) { + this.innerObject = new SqlServerInner(); + this.serviceManager = serviceManager; + this.sqlServerName = name; + } + + public SqlServerImpl update() { + return this; + } + + public SqlServer apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServers() + .createOrUpdateWithResponse( + resourceGroupName, sqlServerRegistrationName, sqlServerName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlServer apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServers() + .createOrUpdateWithResponse( + resourceGroupName, sqlServerRegistrationName, sqlServerName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlServerImpl(SqlServerInner innerObject, com.azure.resourcemanager.azuredata.AzureDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerRegistrationName = Utils.getValueFromIdByName(innerObject.id(), "sqlServerRegistrations"); + this.sqlServerName = Utils.getValueFromIdByName(innerObject.id(), "sqlServers"); + } + + public SqlServer refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getSqlServers() + .getWithResponse(resourceGroupName, sqlServerRegistrationName, sqlServerName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public SqlServer refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getSqlServers() + .getWithResponse(resourceGroupName, sqlServerRegistrationName, sqlServerName, localExpand, context) + .getValue(); + return this; + } + + public SqlServerImpl withVersion(String version) { + this.innerModel().withVersion(version); + return this; + } + + public SqlServerImpl withEdition(String edition) { + this.innerModel().withEdition(edition); + return this; + } + + public SqlServerImpl withRegistrationId(String registrationId) { + this.innerModel().withRegistrationId(registrationId); + return this; + } + + public SqlServerImpl withPropertyBag(String propertyBag) { + this.innerModel().withPropertyBag(propertyBag); + return this; + } + + public SqlServerImpl withCores(Integer cores) { + this.innerModel().withCores(cores); + return this; + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerRegistrationImpl.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerRegistrationImpl.java new file mode 100644 index 0000000000000..7300f8b82b590 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerRegistrationImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerRegistrationInner; +import com.azure.resourcemanager.azuredata.models.SqlServerRegistration; +import com.azure.resourcemanager.azuredata.models.SqlServerRegistrationUpdate; +import java.util.Collections; +import java.util.Map; + +public final class SqlServerRegistrationImpl + implements SqlServerRegistration, SqlServerRegistration.Definition, SqlServerRegistration.Update { + private SqlServerRegistrationInner innerObject; + + private final com.azure.resourcemanager.azuredata.AzureDataManager 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 subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public String resourceGroup() { + return this.innerModel().resourceGroup(); + } + + public String propertyBag() { + return this.innerModel().propertyBag(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SqlServerRegistrationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azuredata.AzureDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerRegistrationName; + + private SqlServerRegistrationUpdate updateParameters; + + public SqlServerRegistrationImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SqlServerRegistration create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerRegistrations() + .createOrUpdateWithResponse( + resourceGroupName, sqlServerRegistrationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlServerRegistration create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerRegistrations() + .createOrUpdateWithResponse(resourceGroupName, sqlServerRegistrationName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlServerRegistrationImpl(String name, com.azure.resourcemanager.azuredata.AzureDataManager serviceManager) { + this.innerObject = new SqlServerRegistrationInner(); + this.serviceManager = serviceManager; + this.sqlServerRegistrationName = name; + } + + public SqlServerRegistrationImpl update() { + this.updateParameters = new SqlServerRegistrationUpdate(); + return this; + } + + public SqlServerRegistration apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerRegistrations() + .updateWithResponse(resourceGroupName, sqlServerRegistrationName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public SqlServerRegistration apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerRegistrations() + .updateWithResponse(resourceGroupName, sqlServerRegistrationName, updateParameters, context) + .getValue(); + return this; + } + + SqlServerRegistrationImpl( + SqlServerRegistrationInner innerObject, com.azure.resourcemanager.azuredata.AzureDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerRegistrationName = Utils.getValueFromIdByName(innerObject.id(), "sqlServerRegistrations"); + } + + public SqlServerRegistration refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerRegistrations() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerRegistrationName, Context.NONE) + .getValue(); + return this; + } + + public SqlServerRegistration refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerRegistrations() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerRegistrationName, context) + .getValue(); + return this; + } + + public SqlServerRegistrationImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlServerRegistrationImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlServerRegistrationImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public SqlServerRegistrationImpl withSubscriptionId(String subscriptionId) { + this.innerModel().withSubscriptionId(subscriptionId); + return this; + } + + public SqlServerRegistrationImpl withResourceGroup(String resourceGroup) { + this.innerModel().withResourceGroup(resourceGroup); + return this; + } + + public SqlServerRegistrationImpl withPropertyBag(String propertyBag) { + this.innerModel().withPropertyBag(propertyBag); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerRegistrationsClientImpl.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerRegistrationsClientImpl.java new file mode 100644 index 0000000000000..9e980edd3ea2c --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerRegistrationsClientImpl.java @@ -0,0 +1,1312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azuredata.fluent.SqlServerRegistrationsClient; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerRegistrationInner; +import com.azure.resourcemanager.azuredata.models.SqlServerRegistrationListResult; +import com.azure.resourcemanager.azuredata.models.SqlServerRegistrationUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlServerRegistrationsClient. */ +public final class SqlServerRegistrationsClientImpl implements SqlServerRegistrationsClient { + private final ClientLogger logger = new ClientLogger(SqlServerRegistrationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SqlServerRegistrationsService service; + + /** The service client containing this operation class. */ + private final AzureDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServerRegistrationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServerRegistrationsClientImpl(AzureDataManagementClientImpl client) { + this.service = + RestProxy + .create(SqlServerRegistrationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDataManagementClientSqlServerRegistrations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDataManagementC") + private interface SqlServerRegistrationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureData" + + "/sqlServerRegistrations/{sqlServerRegistrationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerRegistrationName") String sqlServerRegistrationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureData" + + "/sqlServerRegistrations/{sqlServerRegistrationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerRegistrationName") String sqlServerRegistrationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerRegistrationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureData" + + "/sqlServerRegistrations/{sqlServerRegistrationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerRegistrationName") String sqlServerRegistrationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureData" + + "/sqlServerRegistrations/{sqlServerRegistrationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerRegistrationName") String sqlServerRegistrationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerRegistrationUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureData" + + "/sqlServerRegistrations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureData/sqlServerRegistrations") + @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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String sqlServerRegistrationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName 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 + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String sqlServerRegistrationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName 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 + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String sqlServerRegistrationName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerRegistrationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerRegistrationInner getByResourceGroup(String resourceGroupName, String sqlServerRegistrationName) { + return getByResourceGroupAsync(resourceGroupName, sqlServerRegistrationName).block(); + } + + /** + * Gets a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String sqlServerRegistrationName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerRegistrationName, context).block(); + } + + /** + * Creates or updates a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server registration to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String sqlServerRegistrationName, SqlServerRegistrationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName 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 + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server registration to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String sqlServerRegistrationName, + SqlServerRegistrationInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName 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 + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates or updates a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server registration to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String sqlServerRegistrationName, SqlServerRegistrationInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, sqlServerRegistrationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server registration to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerRegistrationInner createOrUpdate( + String resourceGroupName, String sqlServerRegistrationName, SqlServerRegistrationInner parameters) { + return createOrUpdateAsync(resourceGroupName, sqlServerRegistrationName, parameters).block(); + } + + /** + * Creates or updates a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server registration to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String sqlServerRegistrationName, + SqlServerRegistrationInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, sqlServerRegistrationName, parameters, context) + .block(); + } + + /** + * Deletes a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sqlServerRegistrationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @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 sqlServerRegistrationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sqlServerRegistrationName) { + return deleteWithResponseAsync(resourceGroupName, sqlServerRegistrationName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 sqlServerRegistrationName) { + deleteAsync(resourceGroupName, sqlServerRegistrationName).block(); + } + + /** + * Deletes a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String sqlServerRegistrationName, Context context) { + return deleteWithResponseAsync(resourceGroupName, sqlServerRegistrationName, context).block(); + } + + /** + * Updates SQL Server Registration tags. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server Registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String sqlServerRegistrationName, SqlServerRegistrationUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName 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 + .update( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates SQL Server Registration tags. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server Registration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String sqlServerRegistrationName, + SqlServerRegistrationUpdate parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName 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 + .update( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Updates SQL Server Registration tags. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server Registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String sqlServerRegistrationName, SqlServerRegistrationUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, sqlServerRegistrationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates SQL Server Registration tags. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server Registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerRegistrationInner update( + String resourceGroupName, String sqlServerRegistrationName, SqlServerRegistrationUpdate parameters) { + return updateAsync(resourceGroupName, sqlServerRegistrationName, parameters).block(); + } + + /** + * Updates SQL Server Registration tags. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param parameters The SQL Server Registration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String sqlServerRegistrationName, + SqlServerRegistrationUpdate parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, sqlServerRegistrationName, parameters, context).block(); + } + + /** + * Gets all SQL Server registrations in a resource group. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + 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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all SQL Server registrations in a resource group. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + 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)); + } + + /** + * Gets all SQL Server registrations in a resource group. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all SQL Server registrations in a resource group. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all SQL Server registrations in a resource group. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets all SQL Server registrations in a resource group. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets all SQL Server registrations in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all SQL Server registrations in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all SQL Server registrations in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all SQL Server registrations in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all SQL Server registrations in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets all SQL Server registrations in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a subscription. + */ + @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 server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server. + */ + @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/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerRegistrationsImpl.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerRegistrationsImpl.java new file mode 100644 index 0000000000000..88ba3e4a4c2ca --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServerRegistrationsImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.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.azuredata.fluent.SqlServerRegistrationsClient; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerRegistrationInner; +import com.azure.resourcemanager.azuredata.models.SqlServerRegistration; +import com.azure.resourcemanager.azuredata.models.SqlServerRegistrations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SqlServerRegistrationsImpl implements SqlServerRegistrations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlServerRegistrationsImpl.class); + + private final SqlServerRegistrationsClient innerClient; + + private final com.azure.resourcemanager.azuredata.AzureDataManager serviceManager; + + public SqlServerRegistrationsImpl( + SqlServerRegistrationsClient innerClient, com.azure.resourcemanager.azuredata.AzureDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SqlServerRegistration getByResourceGroup(String resourceGroupName, String sqlServerRegistrationName) { + SqlServerRegistrationInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, sqlServerRegistrationName); + if (inner != null) { + return new SqlServerRegistrationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String sqlServerRegistrationName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlServerRegistrationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlServerRegistrationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String sqlServerRegistrationName) { + this.serviceClient().delete(resourceGroupName, sqlServerRegistrationName); + } + + public Response deleteWithResponse( + String resourceGroupName, String sqlServerRegistrationName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, sqlServerRegistrationName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new SqlServerRegistrationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new SqlServerRegistrationImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SqlServerRegistrationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SqlServerRegistrationImpl(inner1, this.manager())); + } + + public SqlServerRegistration 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 sqlServerRegistrationName = Utils.getValueFromIdByName(id, "sqlServerRegistrations"); + if (sqlServerRegistrationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlServerRegistrations'.", + id))); + } + return this + .getByResourceGroupWithResponse(resourceGroupName, sqlServerRegistrationName, 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 sqlServerRegistrationName = Utils.getValueFromIdByName(id, "sqlServerRegistrations"); + if (sqlServerRegistrationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlServerRegistrations'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerRegistrationName, 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 sqlServerRegistrationName = Utils.getValueFromIdByName(id, "sqlServerRegistrations"); + if (sqlServerRegistrationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlServerRegistrations'.", + id))); + } + this.deleteWithResponse(resourceGroupName, sqlServerRegistrationName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerRegistrationName = Utils.getValueFromIdByName(id, "sqlServerRegistrations"); + if (sqlServerRegistrationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlServerRegistrations'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, sqlServerRegistrationName, context); + } + + private SqlServerRegistrationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azuredata.AzureDataManager manager() { + return this.serviceManager; + } + + public SqlServerRegistrationImpl define(String name) { + return new SqlServerRegistrationImpl(name, this.manager()); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServersClientImpl.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServersClientImpl.java new file mode 100644 index 0000000000000..47082ba7c98a0 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServersClientImpl.java @@ -0,0 +1,1021 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.azuredata.fluent.SqlServersClient; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerInner; +import com.azure.resourcemanager.azuredata.models.SqlServerListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlServersClient. */ +public final class SqlServersClientImpl implements SqlServersClient { + private final ClientLogger logger = new ClientLogger(SqlServersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SqlServersService service; + + /** The service client containing this operation class. */ + private final AzureDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServersClientImpl(AzureDataManagementClientImpl client) { + this.service = + RestProxy.create(SqlServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDataManagementClientSqlServers to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDataManagementC") + private interface SqlServersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureData" + + "/sqlServerRegistrations/{sqlServerRegistrationName}/sqlServers/{sqlServerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerRegistrationName") String sqlServerRegistrationName, + @PathParam("sqlServerName") String sqlServerName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureData" + + "/sqlServerRegistrations/{sqlServerRegistrationName}/sqlServers/{sqlServerName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerRegistrationName") String sqlServerRegistrationName, + @PathParam("sqlServerName") String sqlServerName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureData" + + "/sqlServerRegistrations/{sqlServerRegistrationName}/sqlServers/{sqlServerName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerRegistrationName") String sqlServerRegistrationName, + @PathParam("sqlServerName") String sqlServerName, + @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.AzureData" + + "/sqlServerRegistrations/{sqlServerRegistrationName}/sqlServers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerRegistrationName") String sqlServerRegistrationName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * Gets a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName is required and cannot be null.")); + } + if (sqlServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter sqlServerName 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + sqlServerName, + expand, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String sqlServerRegistrationName, + String sqlServerName, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName is required and cannot be null.")); + } + if (sqlServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter sqlServerName 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + sqlServerName, + expand, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName, String expand) { + return getWithResponseAsync(resourceGroupName, sqlServerRegistrationName, sqlServerName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, sqlServerRegistrationName, sqlServerName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInner get(String resourceGroupName, String sqlServerRegistrationName, String sqlServerName) { + final String expand = null; + return getAsync(resourceGroupName, sqlServerRegistrationName, sqlServerName, expand).block(); + } + + /** + * Gets a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String sqlServerRegistrationName, + String sqlServerName, + String expand, + Context context) { + return getWithResponseAsync(resourceGroupName, sqlServerRegistrationName, sqlServerName, expand, context) + .block(); + } + + /** + * Creates or updates a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param parameters The SQL Server to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName, SqlServerInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName is required and cannot be null.")); + } + if (sqlServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter sqlServerName 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 + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + sqlServerName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param parameters The SQL Server to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String sqlServerRegistrationName, + String sqlServerName, + SqlServerInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName is required and cannot be null.")); + } + if (sqlServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter sqlServerName 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 + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + sqlServerName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates or updates a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param parameters The SQL Server to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName, SqlServerInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, sqlServerRegistrationName, sqlServerName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param parameters The SQL Server to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInner createOrUpdate( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName, SqlServerInner parameters) { + return createOrUpdateAsync(resourceGroupName, sqlServerRegistrationName, sqlServerName, parameters).block(); + } + + /** + * Creates or updates a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param parameters The SQL Server to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String sqlServerRegistrationName, + String sqlServerName, + SqlServerInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, sqlServerRegistrationName, sqlServerName, parameters, context) + .block(); + } + + /** + * Deletes a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sqlServerRegistrationName, String sqlServerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName is required and cannot be null.")); + } + if (sqlServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter sqlServerName 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + sqlServerName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @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 sqlServerRegistrationName, String sqlServerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName is required and cannot be null.")); + } + if (sqlServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter sqlServerName 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + sqlServerName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sqlServerRegistrationName, String sqlServerName) { + return deleteWithResponseAsync(resourceGroupName, sqlServerRegistrationName, sqlServerName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 sqlServerRegistrationName, String sqlServerName) { + deleteAsync(resourceGroupName, sqlServerRegistrationName, sqlServerName).block(); + } + + /** + * Deletes a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName, Context context) { + return deleteWithResponseAsync(resourceGroupName, sqlServerRegistrationName, sqlServerName, context).block(); + } + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String sqlServerRegistrationName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + expand, + 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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String sqlServerRegistrationName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerRegistrationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerRegistrationName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + sqlServerRegistrationName, + expand, + 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)); + } + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String sqlServerRegistrationName, String expand) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, sqlServerRegistrationName, expand), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String sqlServerRegistrationName) { + final String expand = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, sqlServerRegistrationName, expand), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String sqlServerRegistrationName, String expand, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, sqlServerRegistrationName, expand, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String sqlServerRegistrationName) { + final String expand = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, sqlServerRegistrationName, expand)); + } + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String sqlServerRegistrationName, String expand, Context context) { + return new PagedIterable<>( + listByResourceGroupAsync(resourceGroupName, sqlServerRegistrationName, expand, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL servers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL servers. + */ + @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/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServersImpl.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServersImpl.java new file mode 100644 index 0000000000000..01e2694829a7e --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/SqlServersImpl.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.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.azuredata.fluent.SqlServersClient; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerInner; +import com.azure.resourcemanager.azuredata.models.SqlServer; +import com.azure.resourcemanager.azuredata.models.SqlServers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SqlServersImpl implements SqlServers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlServersImpl.class); + + private final SqlServersClient innerClient; + + private final com.azure.resourcemanager.azuredata.AzureDataManager serviceManager; + + public SqlServersImpl( + SqlServersClient innerClient, com.azure.resourcemanager.azuredata.AzureDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SqlServer get(String resourceGroupName, String sqlServerRegistrationName, String sqlServerName) { + SqlServerInner inner = this.serviceClient().get(resourceGroupName, sqlServerRegistrationName, sqlServerName); + if (inner != null) { + return new SqlServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String sqlServerRegistrationName, + String sqlServerName, + String expand, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, sqlServerRegistrationName, sqlServerName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String sqlServerRegistrationName, String sqlServerName) { + this.serviceClient().delete(resourceGroupName, sqlServerRegistrationName, sqlServerName); + } + + public Response deleteWithResponse( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, sqlServerRegistrationName, sqlServerName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String sqlServerRegistrationName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, sqlServerRegistrationName); + return Utils.mapPage(inner, inner1 -> new SqlServerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String sqlServerRegistrationName, String expand, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, sqlServerRegistrationName, expand, context); + return Utils.mapPage(inner, inner1 -> new SqlServerImpl(inner1, this.manager())); + } + + public SqlServer 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 sqlServerRegistrationName = Utils.getValueFromIdByName(id, "sqlServerRegistrations"); + if (sqlServerRegistrationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlServerRegistrations'.", + id))); + } + String sqlServerName = Utils.getValueFromIdByName(id, "sqlServers"); + if (sqlServerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServers'.", id))); + } + String localExpand = null; + return this + .getWithResponse(resourceGroupName, sqlServerRegistrationName, sqlServerName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String expand, 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 sqlServerRegistrationName = Utils.getValueFromIdByName(id, "sqlServerRegistrations"); + if (sqlServerRegistrationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlServerRegistrations'.", + id))); + } + String sqlServerName = Utils.getValueFromIdByName(id, "sqlServers"); + if (sqlServerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServers'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerRegistrationName, sqlServerName, expand, 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 sqlServerRegistrationName = Utils.getValueFromIdByName(id, "sqlServerRegistrations"); + if (sqlServerRegistrationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlServerRegistrations'.", + id))); + } + String sqlServerName = Utils.getValueFromIdByName(id, "sqlServers"); + if (sqlServerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServers'.", id))); + } + this.deleteWithResponse(resourceGroupName, sqlServerRegistrationName, sqlServerName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerRegistrationName = Utils.getValueFromIdByName(id, "sqlServerRegistrations"); + if (sqlServerRegistrationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlServerRegistrations'.", + id))); + } + String sqlServerName = Utils.getValueFromIdByName(id, "sqlServers"); + if (sqlServerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServers'.", id))); + } + return this.deleteWithResponse(resourceGroupName, sqlServerRegistrationName, sqlServerName, context); + } + + private SqlServersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azuredata.AzureDataManager manager() { + return this.serviceManager; + } + + public SqlServerImpl define(String name) { + return new SqlServerImpl(name, this.manager()); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/Utils.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/Utils.java new file mode 100644 index 0000000000000..4561166f46d44 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/package-info.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/package-info.java new file mode 100644 index 0000000000000..de15b1757774f --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for AzureDataManagementClient. The AzureData management API provides a RESTful + * set of web APIs to manage Azure Data Resources. + */ +package com.azure.resourcemanager.azuredata.implementation; diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Identity.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Identity.java new file mode 100644 index 0000000000000..6b681be878c3b --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Identity.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Identity for the resource. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The identity type. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /** + * Get the principalId property: The principal ID of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ODataError.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ODataError.java new file mode 100644 index 0000000000000..2c294327e5165 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ODataError.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.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; + +/** Information about an error. */ +@Fluent +public final class ODataError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ODataError.class); + + /* + * A language-independent error name. + */ + @JsonProperty(value = "code") + private String code; + + /* + * The error message. + */ + @JsonProperty(value = "message") + private String message; + + /* + * The target of the error (for example, the name of the property in + * error). + */ + @JsonProperty(value = "target") + private String target; + + /* + * The error details. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get the code property: A language-independent error name. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: A language-independent error name. + * + * @param code the code value to set. + * @return the ODataError object itself. + */ + public ODataError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The error message. + * + * @param message the message value to set. + * @return the ODataError object itself. + */ + public ODataError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target property: The target of the error (for example, the name of the property in error). + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: The target of the error (for example, the name of the property in error). + * + * @param target the target value to set. + * @return the ODataError object itself. + */ + public ODataError withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the details property: The error details. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Set the details property: The error details. + * + * @param details the details value to set. + * @return the ODataError object itself. + */ + public ODataError withDetails(List details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Operation.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Operation.java new file mode 100644 index 0000000000000..16925864f65a1 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Operation.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.azuredata.models; + +import com.azure.resourcemanager.azuredata.fluent.models.OperationInner; +import java.util.Map; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation being performed on this particular object. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The localized display information for this particular operation / action. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + OperationOrigin origin(); + + /** + * Gets the properties property: Additional descriptions for the operation. + * + * @return the properties value. + */ + Map properties(); + + /** + * Gets the inner com.azure.resourcemanager.azuredata.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/OperationDisplay.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/OperationDisplay.java new file mode 100644 index 0000000000000..2db2aac824d81 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/OperationDisplay.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * The localized friendly form of the resource provider name. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly form of the resource type related to this + * action/operation. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The localized friendly name for the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The localized friendly description for the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: The localized friendly form of the resource provider name. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly form of the resource type related to this action/operation. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The localized friendly name for the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The localized friendly description for the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/OperationListResult.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/OperationListResult.java new file mode 100644 index 0000000000000..8eafa7034fe0e --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/OperationListResult.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.azuredata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azuredata.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the request to list SQL operations. */ +@Immutable +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/OperationOrigin.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/OperationOrigin.java new file mode 100644 index 0000000000000..521e241cac3ae --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/OperationOrigin.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.azuredata.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperationOrigin. */ +public final class OperationOrigin extends ExpandableStringEnum { + /** Static value user for OperationOrigin. */ + public static final OperationOrigin USER = fromString("user"); + + /** Static value system for OperationOrigin. */ + public static final OperationOrigin SYSTEM = fromString("system"); + + /** + * Creates or finds a OperationOrigin from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationOrigin. + */ + @JsonCreator + public static OperationOrigin fromString(String name) { + return fromString(name, OperationOrigin.class); + } + + /** @return known OperationOrigin values. */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Operations.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Operations.java new file mode 100644 index 0000000000000..0a7e7665de1f6 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/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.azuredata.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 SQL Server Registration API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + PagedIterable list(); + + /** + * Lists all of the available SQL Server Registration API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Plan.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Plan.java new file mode 100644 index 0000000000000..4e7c1b0a3e435 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Plan.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.azuredata.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; + +/** Plan for the resource. */ +@Fluent +public class Plan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Plan.class); + + /* + * A user defined name of the 3rd Party Artifact that is being procured. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The publisher of the 3rd Party Artifact that is being bought. E.g. + * NewRelic + */ + @JsonProperty(value = "publisher", required = true) + private String publisher; + + /* + * The 3rd Party artifact that is being procured. E.g. NewRelic. Product + * maps to the OfferID specified for the artifact at the time of Data + * Market onboarding. + */ + @JsonProperty(value = "product", required = true) + private String product; + + /* + * A publisher provided promotion code as provisioned in Data Market for + * the said product/artifact. + */ + @JsonProperty(value = "promotionCode") + private String promotionCode; + + /* + * The version of the desired product/artifact. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the name property: A user defined name of the 3rd Party Artifact that is being procured. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A user defined name of the 3rd Party Artifact that is being procured. + * + * @param name the name value to set. + * @return the Plan object itself. + */ + public Plan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + * + * @param publisher the publisher value to set. + * @return the Plan object itself. + */ + public Plan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the + * OfferID specified for the artifact at the time of Data Market onboarding. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the + * OfferID specified for the artifact at the time of Data Market onboarding. + * + * @param product the product value to set. + * @return the Plan object itself. + */ + public Plan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotionCode property: A publisher provided promotion code as provisioned in Data Market for the said + * product/artifact. + * + * @return the promotionCode value. + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotionCode property: A publisher provided promotion code as provisioned in Data Market for the said + * product/artifact. + * + * @param promotionCode the promotionCode value to set. + * @return the Plan object itself. + */ + public Plan withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Get the version property: The version of the desired product/artifact. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the desired product/artifact. + * + * @param version the version value to set. + * @return the Plan object itself. + */ + public Plan withVersion(String version) { + this.version = version; + 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 Plan")); + } + if (publisher() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property publisher in model Plan")); + } + if (product() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property product in model Plan")); + } + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceIdentityType.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..120080d17423a --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceIdentityType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceModelWithAllowedPropertySetIdentity.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceModelWithAllowedPropertySetIdentity.java new file mode 100644 index 0000000000000..750200f82226f --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceModelWithAllowedPropertySetIdentity.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.azuredata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The ResourceModelWithAllowedPropertySetIdentity model. */ +@Fluent +public class ResourceModelWithAllowedPropertySetIdentity extends Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceModelWithAllowedPropertySetIdentity.class); + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetIdentity withType(ResourceIdentityType type) { + super.withType(type); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceModelWithAllowedPropertySetPlan.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceModelWithAllowedPropertySetPlan.java new file mode 100644 index 0000000000000..2acb683670581 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceModelWithAllowedPropertySetPlan.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The ResourceModelWithAllowedPropertySetPlan model. */ +@Fluent +public final class ResourceModelWithAllowedPropertySetPlan extends Plan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceModelWithAllowedPropertySetPlan.class); + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetPlan withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetPlan withPublisher(String publisher) { + super.withPublisher(publisher); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetPlan withProduct(String product) { + super.withProduct(product); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetPlan withPromotionCode(String promotionCode) { + super.withPromotionCode(promotionCode); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetPlan withVersion(String version) { + super.withVersion(version); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceModelWithAllowedPropertySetSku.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceModelWithAllowedPropertySetSku.java new file mode 100644 index 0000000000000..a6b247988748f --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/ResourceModelWithAllowedPropertySetSku.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The ResourceModelWithAllowedPropertySetSku model. */ +@Fluent +public final class ResourceModelWithAllowedPropertySetSku extends Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceModelWithAllowedPropertySetSku.class); + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetSku withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetSku withTier(SkuTier tier) { + super.withTier(tier); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetSku withSize(String size) { + super.withSize(size); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetSku withFamily(String family) { + super.withFamily(family); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetSku withCapacity(Integer capacity) { + super.withCapacity(capacity); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Sku.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Sku.java new file mode 100644 index 0000000000000..c8194545e138a --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/Sku.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.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 resource model definition representing SKU. */ +@Fluent +public class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * The name of the SKU. Ex - P3. It is typically a letter+number code + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private SkuTier tier; + + /* + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /* + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /* + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @return the tier value. + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); + } + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SkuTier.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SkuTier.java new file mode 100644 index 0000000000000..d1fbdee195c9d --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SkuTier.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SkuTier. */ +public enum SkuTier { + /** Enum value Free. */ + FREE("Free"), + + /** Enum value Basic. */ + BASIC("Basic"), + + /** Enum value Standard. */ + STANDARD("Standard"), + + /** Enum value Premium. */ + PREMIUM("Premium"); + + /** The actual serialized value for a SkuTier instance. */ + private final String value; + + SkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuTier object, or null if unable to parse. + */ + @JsonCreator + public static SkuTier fromString(String value) { + SkuTier[] items = SkuTier.values(); + for (SkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServer.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServer.java new file mode 100644 index 0000000000000..fc77d56e3b9a8 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServer.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerInner; + +/** An immutable client-side representation of SqlServer. */ +public interface SqlServer { + /** + * 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 cores property: Cores of the Sql Server. + * + * @return the cores value. + */ + Integer cores(); + + /** + * Gets the version property: Version of the Sql Server. + * + * @return the version value. + */ + String version(); + + /** + * Gets the edition property: Sql Server Edition. + * + * @return the edition value. + */ + String edition(); + + /** + * Gets the registrationId property: ID for Parent Sql Server Registration. + * + * @return the registrationId value. + */ + String registrationId(); + + /** + * Gets the propertyBag property: Sql Server Json Property Bag. + * + * @return the propertyBag value. + */ + String propertyBag(); + + /** + * Gets the inner com.azure.resourcemanager.azuredata.fluent.models.SqlServerInner object. + * + * @return the inner object. + */ + SqlServerInner innerModel(); + + /** The entirety of the SqlServer definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SqlServer definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlServer definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SqlServer definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, sqlServerRegistrationName. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @return the next definition stage. + */ + WithCreate withExistingSqlServerRegistration(String resourceGroupName, String sqlServerRegistrationName); + } + /** + * The stage of the SqlServer 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.WithVersion, + DefinitionStages.WithEdition, + DefinitionStages.WithRegistrationId, + DefinitionStages.WithPropertyBag { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServer create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServer create(Context context); + } + /** The stage of the SqlServer definition allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: Version of the Sql Server.. + * + * @param version Version of the Sql Server. + * @return the next definition stage. + */ + WithCreate withVersion(String version); + } + /** The stage of the SqlServer definition allowing to specify edition. */ + interface WithEdition { + /** + * Specifies the edition property: Sql Server Edition.. + * + * @param edition Sql Server Edition. + * @return the next definition stage. + */ + WithCreate withEdition(String edition); + } + /** The stage of the SqlServer definition allowing to specify registrationId. */ + interface WithRegistrationId { + /** + * Specifies the registrationId property: ID for Parent Sql Server Registration.. + * + * @param registrationId ID for Parent Sql Server Registration. + * @return the next definition stage. + */ + WithCreate withRegistrationId(String registrationId); + } + /** The stage of the SqlServer definition allowing to specify propertyBag. */ + interface WithPropertyBag { + /** + * Specifies the propertyBag property: Sql Server Json Property Bag.. + * + * @param propertyBag Sql Server Json Property Bag. + * @return the next definition stage. + */ + WithCreate withPropertyBag(String propertyBag); + } + } + /** + * Begins update for the SqlServer resource. + * + * @return the stage of resource update. + */ + SqlServer.Update update(); + + /** The template for SqlServer update. */ + interface Update + extends UpdateStages.WithCores, + UpdateStages.WithVersion, + UpdateStages.WithEdition, + UpdateStages.WithRegistrationId, + UpdateStages.WithPropertyBag { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServer apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServer apply(Context context); + } + /** The SqlServer update stages. */ + interface UpdateStages { + /** The stage of the SqlServer update allowing to specify cores. */ + interface WithCores { + /** + * Specifies the cores property: Cores of the Sql Server.. + * + * @param cores Cores of the Sql Server. + * @return the next definition stage. + */ + Update withCores(Integer cores); + } + /** The stage of the SqlServer update allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: Version of the Sql Server.. + * + * @param version Version of the Sql Server. + * @return the next definition stage. + */ + Update withVersion(String version); + } + /** The stage of the SqlServer update allowing to specify edition. */ + interface WithEdition { + /** + * Specifies the edition property: Sql Server Edition.. + * + * @param edition Sql Server Edition. + * @return the next definition stage. + */ + Update withEdition(String edition); + } + /** The stage of the SqlServer update allowing to specify registrationId. */ + interface WithRegistrationId { + /** + * Specifies the registrationId property: ID for Parent Sql Server Registration.. + * + * @param registrationId ID for Parent Sql Server Registration. + * @return the next definition stage. + */ + Update withRegistrationId(String registrationId); + } + /** The stage of the SqlServer update allowing to specify propertyBag. */ + interface WithPropertyBag { + /** + * Specifies the propertyBag property: Sql Server Json Property Bag.. + * + * @param propertyBag Sql Server Json Property Bag. + * @return the next definition stage. + */ + Update withPropertyBag(String propertyBag); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlServer refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServer refresh(Context context); +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerListResult.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerListResult.java new file mode 100644 index 0000000000000..33b80bea1866c --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerListResult.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.azuredata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of SQL servers. */ +@Immutable +public final class SqlServerListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlServerListResult.class); + + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistration.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistration.java new file mode 100644 index 0000000000000..c4b7bfe4f4fb4 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistration.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerRegistrationInner; +import java.util.Map; + +/** An immutable client-side representation of SqlServerRegistration. */ +public interface SqlServerRegistration { + /** + * 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: Read only system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the subscriptionId property: Subscription Id. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the resourceGroup property: Resource Group Name. + * + * @return the resourceGroup value. + */ + String resourceGroup(); + + /** + * Gets the propertyBag property: Optional Properties as JSON string. + * + * @return the propertyBag value. + */ + String propertyBag(); + + /** + * 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.azuredata.fluent.models.SqlServerRegistrationInner object. + * + * @return the inner object. + */ + SqlServerRegistrationInner innerModel(); + + /** The entirety of the SqlServerRegistration definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroupStage, + DefinitionStages.WithCreate { + } + /** The SqlServerRegistration definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlServerRegistration definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SqlServerRegistration 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. + */ + WithResourceGroupStage withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroupStage withRegion(String location); + } + /** The stage of the SqlServerRegistration definition allowing to specify parent resource. */ + interface WithResourceGroupStage { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the SqlServerRegistration definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithSubscriptionId, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithPropertyBag { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServerRegistration create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServerRegistration create(Context context); + } + /** The stage of the SqlServerRegistration definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the SqlServerRegistration definition allowing to specify subscriptionId. */ + interface WithSubscriptionId { + /** + * Specifies the subscriptionId property: Subscription Id. + * + * @param subscriptionId Subscription Id. + * @return the next definition stage. + */ + WithCreate withSubscriptionId(String subscriptionId); + } + /** The stage of the SqlServerRegistration definition allowing to specify resourceGroup. */ + interface WithResourceGroup { + /** + * Specifies the resourceGroup property: Resource Group Name. + * + * @param resourceGroup Resource Group Name. + * @return the next definition stage. + */ + WithCreate withResourceGroup(String resourceGroup); + } + /** The stage of the SqlServerRegistration definition allowing to specify propertyBag. */ + interface WithPropertyBag { + /** + * Specifies the propertyBag property: Optional Properties as JSON string. + * + * @param propertyBag Optional Properties as JSON string. + * @return the next definition stage. + */ + WithCreate withPropertyBag(String propertyBag); + } + } + /** + * Begins update for the SqlServerRegistration resource. + * + * @return the stage of resource update. + */ + SqlServerRegistration.Update update(); + + /** The template for SqlServerRegistration update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServerRegistration apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServerRegistration apply(Context context); + } + /** The SqlServerRegistration update stages. */ + interface UpdateStages { + /** The stage of the SqlServerRegistration 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. + */ + SqlServerRegistration refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServerRegistration refresh(Context context); +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistrationListResult.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistrationListResult.java new file mode 100644 index 0000000000000..286968c0c72c8 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistrationListResult.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.azuredata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azuredata.fluent.models.SqlServerRegistrationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Server. */ +@Immutable +public final class SqlServerRegistrationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlServerRegistrationListResult.class); + + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistrationUpdate.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistrationUpdate.java new file mode 100644 index 0000000000000..ca9855b973eda --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistrationUpdate.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to a SQL Server Registration. */ +@Fluent +public final class SqlServerRegistrationUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlServerRegistrationUpdate.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + 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 SqlServerRegistrationUpdate object itself. + */ + public SqlServerRegistrationUpdate 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/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistrations.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistrations.java new file mode 100644 index 0000000000000..ac1345e5d9093 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServerRegistrations.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.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 SqlServerRegistrations. */ +public interface SqlServerRegistrations { + /** + * Gets a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server registration. + */ + SqlServerRegistration getByResourceGroup(String resourceGroupName, String sqlServerRegistrationName); + + /** + * Gets a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server registration. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String sqlServerRegistrationName, Context context); + + /** + * Deletes a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @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 sqlServerRegistrationName); + + /** + * Deletes a SQL Server registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String sqlServerRegistrationName, Context context); + + /** + * Gets all SQL Server registrations in a resource group. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all SQL Server registrations in a resource group. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all SQL Server registrations in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a subscription. + */ + PagedIterable list(); + + /** + * Gets all SQL Server registrations in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Server registrations in a subscription. + */ + PagedIterable list(Context context); + + /** + * Gets a SQL Server registration. + * + * @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 a SQL Server registration. + */ + SqlServerRegistration getById(String id); + + /** + * Gets a SQL Server registration. + * + * @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 a SQL Server registration. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a SQL Server registration. + * + * @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 SQL Server registration. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlServerRegistration resource. + * + * @param name resource name. + * @return the first stage of the new SqlServerRegistration definition. + */ + SqlServerRegistration.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServers.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServers.java new file mode 100644 index 0000000000000..a45cca53bdc40 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/SqlServers.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.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 SqlServers. */ +public interface SqlServers { + /** + * Gets a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + SqlServer get(String resourceGroupName, String sqlServerRegistrationName, String sqlServerName); + + /** + * Gets a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + Response getWithResponse( + String resourceGroupName, + String sqlServerRegistrationName, + String sqlServerName, + String expand, + Context context); + + /** + * Deletes a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @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 sqlServerRegistrationName, String sqlServerName); + + /** + * Deletes a SQL Server. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param sqlServerName Name of the SQL Server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, String sqlServerRegistrationName, String sqlServerName, Context context); + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String sqlServerRegistrationName); + + /** + * Gets all SQL Servers in a SQL Server Registration. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlServerRegistrationName Name of the SQL Server registration. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all SQL Servers in a SQL Server Registration. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, String sqlServerRegistrationName, String expand, Context context); + + /** + * Gets a SQL Server. + * + * @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 a SQL Server. + */ + SqlServer getById(String id); + + /** + * Gets a SQL Server. + * + * @param id the resource ID. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Server. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Deletes a SQL Server. + * + * @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 SQL Server. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlServer resource. + * + * @param name resource name. + * @return the first stage of the new SqlServer definition. + */ + SqlServer.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/package-info.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/package-info.java new file mode 100644 index 0000000000000..c7ab4eb0f2989 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for AzureDataManagementClient. The AzureData management API provides a RESTful set + * of web APIs to manage Azure Data Resources. + */ +package com.azure.resourcemanager.azuredata.models; diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/package-info.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/package-info.java new file mode 100644 index 0000000000000..c0237b21c27b1 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/com/azure/resourcemanager/azuredata/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for AzureDataManagementClient. The AzureData management API provides a RESTful set of + * web APIs to manage Azure Data Resources. + */ +package com.azure.resourcemanager.azuredata; diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/module-info.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/main/java/module-info.java new file mode 100644 index 0000000000000..d695ef51fa8b3 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/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.azuredata { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.azuredata; + exports com.azure.resourcemanager.azuredata.fluent; + exports com.azure.resourcemanager.azuredata.fluent.models; + exports com.azure.resourcemanager.azuredata.models; + + opens com.azure.resourcemanager.azuredata.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.azuredata.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/OperationsListSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..def56c06f9c42 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/ListOperation.json + */ + /** + * Sample code: Lists all of the available SQL Server Registration API operations. + * + * @param manager Entry point to AzureDataManager. + */ + public static void listsAllOfTheAvailableSQLServerRegistrationAPIOperations( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsCreateOrUpdateSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..076aab6036004 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsCreateOrUpdateSamples.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.azuredata.generated; + +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlServerRegistrations CreateOrUpdate. */ +public final class SqlServerRegistrationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/CreateOrUpdateSqlServerRegistration.json + */ + /** + * Sample code: Creates or updates a SQL Server registration. + * + * @param manager Entry point to AzureDataManager. + */ + public static void createsOrUpdatesASQLServerRegistration( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager + .sqlServerRegistrations() + .define("testsqlregistration") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withTags(mapOf("mytag", "myval")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsDeleteSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsDeleteSamples.java new file mode 100644 index 0000000000000..e9409d4659d64 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlServerRegistrations Delete. */ +public final class SqlServerRegistrationsDeleteSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/DeleteSqlServerRegistration.json + */ + /** + * Sample code: Deletes a SQL Server registration. + * + * @param manager Entry point to AzureDataManager. + */ + public static void deletesASQLServerRegistration(com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServerRegistrations().deleteWithResponse("testrg", "testsqlregistration", Context.NONE); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsGetByResourceGroupSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..0c3b516d375d1 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlServerRegistrations GetByResourceGroup. */ +public final class SqlServerRegistrationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/GetSqlServerRegistration.json + */ + /** + * Sample code: Gets a SQL Server registration. + * + * @param manager Entry point to AzureDataManager. + */ + public static void getsASQLServerRegistration(com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServerRegistrations().getByResourceGroupWithResponse("testrg", "testsqlregistration", Context.NONE); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsListByResourceGroupSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..edf339f920625 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlServerRegistrations ListByResourceGroup. */ +public final class SqlServerRegistrationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/ListByResourceGroupSqlServerRegistration.json + */ + /** + * Sample code: Gets all SQL Server registrations in a resource group. + * + * @param manager Entry point to AzureDataManager. + */ + public static void getsAllSQLServerRegistrationsInAResourceGroup( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServerRegistrations().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsListSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsListSamples.java new file mode 100644 index 0000000000000..68f5ec820f079 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlServerRegistrations List. */ +public final class SqlServerRegistrationsListSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/ListSubscriptionSqlServerRegistration.json + */ + /** + * Sample code: Gets all SQL Server registrations in a subscription. + * + * @param manager Entry point to AzureDataManager. + */ + public static void getsAllSQLServerRegistrationsInASubscription( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServerRegistrations().list(Context.NONE); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsUpdateSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsUpdateSamples.java new file mode 100644 index 0000000000000..a5bfa2609c221 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServerRegistrationsUpdateSamples.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.azuredata.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.azuredata.models.SqlServerRegistration; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlServerRegistrations Update. */ +public final class SqlServerRegistrationsUpdateSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/UpdateSqlServerRegistration.json + */ + /** + * Sample code: Updates a SQL Server Registration tags. + * + * @param manager Entry point to AzureDataManager. + */ + public static void updatesASQLServerRegistrationTags(com.azure.resourcemanager.azuredata.AzureDataManager manager) { + SqlServerRegistration resource = + manager + .sqlServerRegistrations() + .getByResourceGroupWithResponse("testrg", "testsqlregistration", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersCreateOrUpdateSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3abab755977d4 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.generated; + +/** Samples for SqlServers CreateOrUpdate. */ +public final class SqlServersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/CreateOrUpdateSqlServerWithRegistrationGroup.json + */ + /** + * Sample code: Creates or updates a SQL Server in a Registration group. + * + * @param manager Entry point to AzureDataManager. + */ + public static void createsOrUpdatesASQLServerInARegistrationGroup( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager + .sqlServers() + .define("testsqlserver") + .withExistingSqlServerRegistration("testrg", "testsqlregistration") + .withVersion("2008") + .withEdition("Latin") + .withRegistrationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureData/SqlServerRegistrations/testsqlregistration") + .withPropertyBag("") + .create(); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersDeleteSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersDeleteSamples.java new file mode 100644 index 0000000000000..f7cf8bc9ea9e6 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlServers Delete. */ +public final class SqlServersDeleteSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/DeleteSqlServer.json + */ + /** + * Sample code: Deletes a SQL Server. + * + * @param manager Entry point to AzureDataManager. + */ + public static void deletesASQLServer(com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServers().deleteWithResponse("testrg", "testsqlregistration", "testsqlserver", Context.NONE); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersGetSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersGetSamples.java new file mode 100644 index 0000000000000..9cf0b51292c8b --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlServers Get. */ +public final class SqlServersGetSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/GetSqlServer.json + */ + /** + * Sample code: Gets a SQL Server. + * + * @param manager Entry point to AzureDataManager. + */ + public static void getsASQLServer(com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServers().getWithResponse("testrg", "testsqlregistration", "testsqlserver", null, Context.NONE); + } +} diff --git a/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersListByResourceGroupSamples.java b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..1693dd0ab79f3 --- /dev/null +++ b/sdk/azuredata/azure-resourcemanager-azuredata/src/samples/java/com/azure/resourcemanager/azuredata/generated/SqlServersListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azuredata.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlServers ListByResourceGroup. */ +public final class SqlServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azuredata/resource-manager/Microsoft.AzureData/preview/2019-07-24-preview/examples/ListByResourceGroupSqlServer.json + */ + /** + * Sample code: Gets all SQL Servers in a SQL Server Registration. + * + * @param manager Entry point to AzureDataManager. + */ + public static void getsAllSQLServersInASQLServerRegistration( + com.azure.resourcemanager.azuredata.AzureDataManager manager) { + manager.sqlServers().listByResourceGroup("testrg", "testsqlregistration", null, Context.NONE); + } +} diff --git a/sdk/azuredata/ci.yml b/sdk/azuredata/ci.yml new file mode 100644 index 0000000000000..5e575bcc672c5 --- /dev/null +++ b/sdk/azuredata/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/azuredata/ci.yml + - sdk/azuredata/azure-resourcemanager-azuredata/ + exclude: + - sdk/azuredata/pom.xml + - sdk/azuredata/azure-resourcemanager-azuredata/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azuredata/ci.yml + - sdk/azuredata/azure-resourcemanager-azuredata/ + exclude: + - sdk/azuredata/pom.xml + - sdk/azuredata/azure-resourcemanager-azuredata/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: azuredata + Artifacts: + - name: azure-resourcemanager-azuredata + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerazuredata diff --git a/sdk/azuredata/pom.xml b/sdk/azuredata/pom.xml new file mode 100644 index 0000000000000..e7feda9a53b08 --- /dev/null +++ b/sdk/azuredata/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-azuredata-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-azuredata + + + +